diff options
author | Daniel Drake <dsd@laptop.org> | 2012-08-02 18:41:48 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-08-15 08:10:32 -0700 |
commit | 25320e75fe0296dab5ae37c6b59f18899cd1c310 (patch) | |
tree | 207d5ae58f78b1331e71e339b618736ac9acd3b8 | |
parent | 5784dff6267c788b40a2c9931b13a079e9011936 (diff) | |
download | linux-3.10-25320e75fe0296dab5ae37c6b59f18899cd1c310.tar.gz linux-3.10-25320e75fe0296dab5ae37c6b59f18899cd1c310.tar.bz2 linux-3.10-25320e75fe0296dab5ae37c6b59f18899cd1c310.zip |
cfg80211: process pending events when unregistering net device
commit 1f6fc43e621167492ed4b7f3b4269c584c3d6ccc upstream.
libertas currently calls cfg80211_disconnected() when it is being
brought down. This causes an event to be allocated, but since the
wdev is already removed from the rdev by the time that the event
processing work executes, the event is never processed or freed.
http://article.gmane.org/gmane.linux.kernel.wireless.general/95666
Fix this leak, and other possible situations, by processing the event
queue when a device is being unregistered. Thanks to Johannes Berg for
the suggestion.
Signed-off-by: Daniel Drake <dsd@laptop.org>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | net/wireless/core.c | 5 | ||||
-rw-r--r-- | net/wireless/core.h | 1 | ||||
-rw-r--r-- | net/wireless/util.c | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c index ccdfed89765..bb5302dd592 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -975,6 +975,11 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb, */ synchronize_rcu(); INIT_LIST_HEAD(&wdev->list); + /* + * Ensure that all events have been processed and + * freed. + */ + cfg80211_process_wdev_events(wdev); break; case NETDEV_PRE_UP: if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype))) diff --git a/net/wireless/core.h b/net/wireless/core.h index 3ac2dd00d71..ce5597c6459 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h @@ -426,6 +426,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev, struct net_device *dev, enum nl80211_iftype ntype, u32 *flags, struct vif_params *params); void cfg80211_process_rdev_events(struct cfg80211_registered_device *rdev); +void cfg80211_process_wdev_events(struct wireless_dev *wdev); int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev, struct wireless_dev *wdev, diff --git a/net/wireless/util.c b/net/wireless/util.c index 0eb6cc0c77d..63b37d3f3c0 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -717,7 +717,7 @@ void cfg80211_upload_connect_keys(struct wireless_dev *wdev) wdev->connect_keys = NULL; } -static void cfg80211_process_wdev_events(struct wireless_dev *wdev) +void cfg80211_process_wdev_events(struct wireless_dev *wdev) { struct cfg80211_event *ev; unsigned long flags; |