mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-02-13 16:11:54 +00:00
cfg80211: fix wext-compat memory leak
cfg80211_wext_giwrate and sinfo.pertid might allocate sinfo.pertid via rdev_get_station(), but never release it. Fix that. Fixes: 8689c051a201 ("cfg80211: dynamically allocate per-tid stats for station info") Signed-off-by: Stefan Seyfried <seife+kernel@b1-systems.com> [johannes: fix error path, use cfg80211_sinfo_release_content(), add Fixes] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
43955a45dc
commit
848e616e66
@ -1278,12 +1278,16 @@ static int cfg80211_wext_giwrate(struct net_device *dev,
|
|||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (!(sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE)))
|
if (!(sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE))) {
|
||||||
return -EOPNOTSUPP;
|
err = -EOPNOTSUPP;
|
||||||
|
goto free;
|
||||||
|
}
|
||||||
|
|
||||||
rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo.txrate);
|
rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo.txrate);
|
||||||
|
|
||||||
return 0;
|
free:
|
||||||
|
cfg80211_sinfo_release_content(&sinfo);
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
|
/* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
|
||||||
@ -1293,7 +1297,7 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
|
|||||||
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
|
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
|
||||||
/* we are under RTNL - globally locked - so can use static structs */
|
/* we are under RTNL - globally locked - so can use static structs */
|
||||||
static struct iw_statistics wstats;
|
static struct iw_statistics wstats;
|
||||||
static struct station_info sinfo;
|
static struct station_info sinfo = {};
|
||||||
u8 bssid[ETH_ALEN];
|
u8 bssid[ETH_ALEN];
|
||||||
|
|
||||||
if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION)
|
if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION)
|
||||||
@ -1352,6 +1356,8 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
|
|||||||
if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_FAILED))
|
if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_FAILED))
|
||||||
wstats.discard.retries = sinfo.tx_failed;
|
wstats.discard.retries = sinfo.tx_failed;
|
||||||
|
|
||||||
|
cfg80211_sinfo_release_content(&sinfo);
|
||||||
|
|
||||||
return &wstats;
|
return &wstats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user