summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorBen Greear <greearb@candelatech.com>2013-06-19 23:06:26 +0200
committerJohannes Berg <johannes.berg@intel.com>2013-06-24 15:55:36 +0200
commitf9bef3df52fe61067e4c1c6cfb2037cb6b259a6a (patch)
tree80d8f1dfd41630b161095f301d4f158838dc73c0 /net
parentwireless: add comments about bss refcounting (diff)
downloadlinux-f9bef3df52fe61067e4c1c6cfb2037cb6b259a6a.tar.xz
linux-f9bef3df52fe61067e4c1c6cfb2037cb6b259a6a.zip
wireless: check for dangling wdev->current_bss pointer
If it *is* still set when the netdev is being deleted, then we are about to leak a pointer. Warn and clean up in that case. Signed-off-by: Ben Greear <greearb@candelatech.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/wireless/core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 4224e7554a76..672459b9483b 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -934,6 +934,12 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
* freed.
*/
cfg80211_process_wdev_events(wdev);
+
+ if (WARN_ON(wdev->current_bss)) {
+ cfg80211_unhold_bss(wdev->current_bss);
+ cfg80211_put_bss(wdev->wiphy, &wdev->current_bss->pub);
+ wdev->current_bss = NULL;
+ }
break;
case NETDEV_PRE_UP:
if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)))