Skip to content

Commit

Permalink
b43: Fix rfkill allocation leakage in error paths
Browse files Browse the repository at this point in the history
We must kill rfkill in any error paths that trigger after rfkill init.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Michael Buesch authored and David S. Miller committed Feb 1, 2008
1 parent be9b725 commit 1946a2c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/net/wireless/b43/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3630,6 +3630,7 @@ static int b43_op_start(struct ieee80211_hw *hw)
struct b43_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. */
Expand All @@ -3639,8 +3640,10 @@ static int b43_op_start(struct ieee80211_hw *hw)

if (b43_status(dev) < B43_STAT_INITIALIZED) {
err = b43_wireless_core_init(dev);
if (err)
if (err) {
do_rfkill_exit = 1;
goto out_mutex_unlock;
}
did_init = 1;
}

Expand All @@ -3649,13 +3652,17 @@ static int b43_op_start(struct ieee80211_hw *hw)
if (err) {
if (did_init)
b43_wireless_core_exit(dev);
do_rfkill_exit = 1;
goto out_mutex_unlock;
}
}

out_mutex_unlock:
mutex_unlock(&wl->mutex);

if (do_rfkill_exit)
b43_rfkill_exit(dev);

return err;
}

Expand Down

0 comments on commit 1946a2c

Please sign in to comment.