This is a note to let you know that I've just added the patch titled

    cfg80211: fix wiphy_register error path

to the 3.9-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     cfg80211-fix-wiphy_register-error-path.patch
and it can be found in the queue-3.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 03cd7e4e1ea16cd151c799a33b5ca1fd41a464df Mon Sep 17 00:00:00 2001
From: Johannes Berg <[email protected]>
Date: Fri, 10 May 2013 19:23:40 +0200
Subject: cfg80211: fix wiphy_register error path

From: Johannes Berg <[email protected]>

commit 03cd7e4e1ea16cd151c799a33b5ca1fd41a464df upstream.

If rfkill_register() fails in wiphy_register() the struct device
is unregistered but everything else isn't (regulatory, debugfs)
and we even leave the wiphy instance on all internal lists even
though it will likely be freed soon, which is clearly a problem.
Fix this by cleaning up properly.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 net/wireless/core.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -638,17 +638,21 @@ int wiphy_register(struct wiphy *wiphy)
         * cfg80211_mutex lock
         */
        res = rfkill_register(rdev->rfkill);
-       if (res)
-               goto out_rm_dev;
+       if (res) {
+               device_del(&rdev->wiphy.dev);
+
+               mutex_lock(&cfg80211_mutex);
+               debugfs_remove_recursive(rdev->wiphy.debugfsdir);
+               list_del_rcu(&rdev->list);
+               wiphy_regulatory_deregister(wiphy);
+               mutex_unlock(&cfg80211_mutex);
+               return res;
+       }
 
        rtnl_lock();
        rdev->wiphy.registered = true;
        rtnl_unlock();
        return 0;
-
-out_rm_dev:
-       device_del(&rdev->wiphy.dev);
-       return res;
 }
 EXPORT_SYMBOL(wiphy_register);
 


Patches currently in stable-queue which might be from [email protected] 
are

queue-3.9/mac80211-use-just-spin_lock-in-ieee80211_get_tkip_p2k.patch
queue-3.9/cfg80211-fix-wiphy_register-error-path.patch
queue-3.9/mac80211-fix-ap-mode-frame-matching.patch
queue-3.9/cfg80211-fix-wowlan-wakeup-tracing.patch
queue-3.9/iwlwifi-mvm-always-use-scan_type_forced.patch
queue-3.9/cfg80211-fix-sending-wowlan-tcp-wakeup-settings.patch
queue-3.9/iwlwifi-mvm-prevent-setting-assoc-flag-in-mac_context_cmd.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to