cfg80211: initialize sinfo in cfg80211_get_station
authorSven Eckelmann <sven@narfation.org>
Wed, 6 Jun 2018 08:53:55 +0000 (10:53 +0200)
committerJohannes Berg <johannes@sipsolutions.net>
Fri, 15 Jun 2018 11:01:47 +0000 (13:01 +0200)
commit3c12d0486856b9eb89c2a9ac336713cba90813e3
treeadbc92126e654eb2dcc1478989d31473e24f0bb3
parentbadbc27df3a934e0025be238754f9ca6a852c006
cfg80211: initialize sinfo in cfg80211_get_station

Most of the implementations behind cfg80211_get_station will not initialize
sinfo to zero before manipulating it. For example, the member "filled",
which indicates the filled in parts of this struct, is often only modified
by enabling certain bits in the bitfield while keeping the remaining bits
in their original state. A caller without a preinitialized sinfo.filled can
then no longer decide which parts of sinfo were filled in by
cfg80211_get_station (or actually the underlying implementations).

cfg80211_get_station must therefore take care that sinfo is initialized to
zero. Otherwise, the caller may tries to read information which was not
filled in and which must therefore also be considered uninitialized. In
batadv_v_elp_get_throughput's case, an invalid "random" expected throughput
may be stored for this neighbor and thus the B.A.T.M.A.N V algorithm may
switch to non-optimal neighbors for certain destinations.

Fixes: 7406353d43c8 ("cfg80211: implement cfg80211_get_station cfg80211 API")
Reported-by: Thomas Lauer <holminateur@gmail.com>
Reported-by: Marcel Schmidt <ff.z-casparistrasse@mailbox.org>
Cc: b.a.t.m.a.n@lists.open-mesh.org
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
net/wireless/util.c