]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
b43legacy: Fix rfkill allocation leakage in error paths
authorMichael Buesch <mb@bu3sch.de>
Wed, 23 Jan 2008 11:15:38 +0000 (12:15 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 Feb 2008 03:26:36 +0000 (19:26 -0800)
We must kill rfkill in any error paths that trigger after rfkill init.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Acked-by: Stefano Brivio <stefano.brivio@polimi.it>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wireless/b43legacy/main.c

index 4ed4243feeaa7cf659910b40e8f6bccbdbe8c2db..b9a046ff6dc6ad5c670a1ba2ac3fc4db38feddd5 100644 (file)
@@ -3221,6 +3221,7 @@ static int b43legacy_op_start(struct ieee80211_hw *hw)
        struct b43legacy_wldev *dev = wl->current_dev;
        int did_init = 0;
        int err = 0;
+       bool do_rfkill_exit = 0;
 
        /* First register RFkill.
         * LEDs that are registered later depend on it. */
@@ -3230,8 +3231,10 @@ static int b43legacy_op_start(struct ieee80211_hw *hw)
 
        if (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED) {
                err = b43legacy_wireless_core_init(dev);
-               if (err)
+               if (err) {
+                       do_rfkill_exit = 1;
                        goto out_mutex_unlock;
+               }
                did_init = 1;
        }
 
@@ -3240,6 +3243,7 @@ static int b43legacy_op_start(struct ieee80211_hw *hw)
                if (err) {
                        if (did_init)
                                b43legacy_wireless_core_exit(dev);
+                       do_rfkill_exit = 1;
                        goto out_mutex_unlock;
                }
        }
@@ -3247,6 +3251,9 @@ static int b43legacy_op_start(struct ieee80211_hw *hw)
 out_mutex_unlock:
        mutex_unlock(&wl->mutex);
 
+       if (do_rfkill_exit)
+               b43legacy_rfkill_exit(dev);
+
        return err;
 }