Commit 8712f276 authored by Michael Buesch's avatar Michael Buesch Committed by David S. Miller

b43legacy: Fix rfkill allocation leakage in error paths

We must kill rfkill in any error paths that trigger after rfkill init.
Signed-off-by: default avatarMichael Buesch <mb@bu3sch.de>
Acked-by: default avatarStefano Brivio <stefano.brivio@polimi.it>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1946a2c3
...@@ -3221,6 +3221,7 @@ static int b43legacy_op_start(struct ieee80211_hw *hw) ...@@ -3221,6 +3221,7 @@ static int b43legacy_op_start(struct ieee80211_hw *hw)
struct b43legacy_wldev *dev = wl->current_dev; struct b43legacy_wldev *dev = wl->current_dev;
int did_init = 0; int did_init = 0;
int err = 0; int err = 0;
bool do_rfkill_exit = 0;
/* First register RFkill. /* First register RFkill.
* LEDs that are registered later depend on it. */ * LEDs that are registered later depend on it. */
...@@ -3230,8 +3231,10 @@ static int b43legacy_op_start(struct ieee80211_hw *hw) ...@@ -3230,8 +3231,10 @@ static int b43legacy_op_start(struct ieee80211_hw *hw)
if (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED) { if (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED) {
err = b43legacy_wireless_core_init(dev); err = b43legacy_wireless_core_init(dev);
if (err) if (err) {
do_rfkill_exit = 1;
goto out_mutex_unlock; goto out_mutex_unlock;
}
did_init = 1; did_init = 1;
} }
...@@ -3240,6 +3243,7 @@ static int b43legacy_op_start(struct ieee80211_hw *hw) ...@@ -3240,6 +3243,7 @@ static int b43legacy_op_start(struct ieee80211_hw *hw)
if (err) { if (err) {
if (did_init) if (did_init)
b43legacy_wireless_core_exit(dev); b43legacy_wireless_core_exit(dev);
do_rfkill_exit = 1;
goto out_mutex_unlock; goto out_mutex_unlock;
} }
} }
...@@ -3247,6 +3251,9 @@ static int b43legacy_op_start(struct ieee80211_hw *hw) ...@@ -3247,6 +3251,9 @@ static int b43legacy_op_start(struct ieee80211_hw *hw)
out_mutex_unlock: out_mutex_unlock:
mutex_unlock(&wl->mutex); mutex_unlock(&wl->mutex);
if (do_rfkill_exit)
b43legacy_rfkill_exit(dev);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment