Skip to content

Commit 9c5a18a

Browse files
jmberg-inteldavem330
authored andcommitted
cfg80211: wext: clear sinfo struct before calling driver
Until recently, mac80211 overwrote all the statistics it could provide when getting called, but it now relies on the struct having been zeroed by the caller. This was always the case in nl80211, but wext used a static struct which could even cause values from one device leak to another. Using a static struct is OK (as even documented in a comment) since the whole usage of this function and its return value is always locked under RTNL. Not clearing the struct for calling the driver has always been wrong though, since drivers were free to only fill values they could report, so calling this for one device and then for another would always have leaked values from one to the other. Fix this by initializing the structure in question before the driver method call. This fixes https://bugzilla.kernel.org/show_bug.cgi?id=99691 Cc: [email protected] Reported-by: Gerrit Renker <[email protected]> Reported-by: Alexander Kaltsas <[email protected]> Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5879ae5 commit 9c5a18a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/wireless/wext-compat.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,8 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
13331333
memcpy(bssid, wdev->current_bss->pub.bssid, ETH_ALEN);
13341334
wdev_unlock(wdev);
13351335

1336+
memset(&sinfo, 0, sizeof(sinfo));
1337+
13361338
if (rdev_get_station(rdev, dev, bssid, &sinfo))
13371339
return NULL;
13381340

0 commit comments

Comments
 (0)