wext: unregister_pernet_subsys() on notifier registration failure
authorJohannes Berg <johannes.berg@intel.com>
Wed, 16 Mar 2016 13:29:08 +0000 (14:29 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 5 Apr 2016 08:48:44 +0000 (10:48 +0200)
If register_netdevice_notifier() fails (which in practice it can't
right now), we should call unregister_pernet_subsys(). Do that.

Reported-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/wext-core.c

index b50ee5d622e14d4fb486ce0c533757e958702f54..6250b1cfcde58758bb480758d1c61217d37a7cd1 100644 (file)
@@ -399,7 +399,10 @@ static int __init wireless_nlevent_init(void)
        if (err)
                return err;
 
-       return register_netdevice_notifier(&wext_netdev_notifier);
+       err = register_netdevice_notifier(&wext_netdev_notifier);
+       if (err)
+               unregister_pernet_subsys(&wext_pernet_ops);
+       return err;
 }
 
 subsys_initcall(wireless_nlevent_init);