Skip to content

Commit

Permalink
cfg80211: wext: clear sinfo struct before calling driver
Browse files Browse the repository at this point in the history
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: stable@vger.kernel.org
Reported-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Reported-by: Alexander Kaltsas <alexkaltsas@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
jmberg-intel authored and davem330 committed Jun 9, 2015
1 parent 5879ae5 commit 9c5a18a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/wireless/wext-compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,8 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
memcpy(bssid, wdev->current_bss->pub.bssid, ETH_ALEN);
wdev_unlock(wdev);

memset(&sinfo, 0, sizeof(sinfo));

if (rdev_get_station(rdev, dev, bssid, &sinfo))
return NULL;

Expand Down

0 comments on commit 9c5a18a

Please sign in to comment.