cfg80211: fix rcu in cfg80211_unregister_wdev
authorDedy Lansky <dlansky@codeaurora.org>
Fri, 15 Jun 2018 11:05:01 +0000 (13:05 +0200)
committerJohannes Berg <johannes@sipsolutions.net>
Fri, 15 Jun 2018 11:05:14 +0000 (13:05 +0200)
Callers of cfg80211_unregister_wdev can free the wdev object
immediately after this function returns. This may crash the kernel
because this wdev object is still in use by other threads.
Add synchronize_rcu() after list_del_rcu to make sure wdev object can
be safely freed.

Signed-off-by: Dedy Lansky <dlansky@codeaurora.org>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
net/wireless/core.c

index 5fe35aafdd9cf849d78d46f0f7d960356c804987..48e8097339ab44cca29bc9bbc938b58ea3a43333 100644 (file)
@@ -1012,6 +1012,7 @@ void cfg80211_unregister_wdev(struct wireless_dev *wdev)
        nl80211_notify_iface(rdev, wdev, NL80211_CMD_DEL_INTERFACE);
 
        list_del_rcu(&wdev->list);
+       synchronize_rcu();
        rdev->devlist_generation++;
 
        switch (wdev->iftype) {