mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 10:57:46 +00:00
b43: fix use-after-free rfkill bug
Fix rfkill code which caused a use-after-free bug. Signed-off-by: Stefano Brivio <stefano.brivio@polimi.it> Acked-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
8ff9d21ee2
commit
a38db5b621
1 changed files with 6 additions and 5 deletions
|
@ -138,8 +138,11 @@ void b43_rfkill_init(struct b43_wldev *dev)
|
||||||
rfk->rfkill->user_claim_unsupported = 1;
|
rfk->rfkill->user_claim_unsupported = 1;
|
||||||
|
|
||||||
rfk->poll_dev = input_allocate_polled_device();
|
rfk->poll_dev = input_allocate_polled_device();
|
||||||
if (!rfk->poll_dev)
|
if (!rfk->poll_dev) {
|
||||||
goto err_free_rfk;
|
rfkill_free(rfk->rfkill);
|
||||||
|
goto err_freed_rfk;
|
||||||
|
}
|
||||||
|
|
||||||
rfk->poll_dev->private = dev;
|
rfk->poll_dev->private = dev;
|
||||||
rfk->poll_dev->poll = b43_rfkill_poll;
|
rfk->poll_dev->poll = b43_rfkill_poll;
|
||||||
rfk->poll_dev->poll_interval = 1000; /* msecs */
|
rfk->poll_dev->poll_interval = 1000; /* msecs */
|
||||||
|
@ -175,8 +178,7 @@ void b43_rfkill_init(struct b43_wldev *dev)
|
||||||
err_free_polldev:
|
err_free_polldev:
|
||||||
input_free_polled_device(rfk->poll_dev);
|
input_free_polled_device(rfk->poll_dev);
|
||||||
rfk->poll_dev = NULL;
|
rfk->poll_dev = NULL;
|
||||||
err_free_rfk:
|
err_freed_rfk:
|
||||||
rfkill_free(rfk->rfkill);
|
|
||||||
rfk->rfkill = NULL;
|
rfk->rfkill = NULL;
|
||||||
out_error:
|
out_error:
|
||||||
rfk->registered = 0;
|
rfk->registered = 0;
|
||||||
|
@ -195,6 +197,5 @@ void b43_rfkill_exit(struct b43_wldev *dev)
|
||||||
rfkill_unregister(rfk->rfkill);
|
rfkill_unregister(rfk->rfkill);
|
||||||
input_free_polled_device(rfk->poll_dev);
|
input_free_polled_device(rfk->poll_dev);
|
||||||
rfk->poll_dev = NULL;
|
rfk->poll_dev = NULL;
|
||||||
rfkill_free(rfk->rfkill);
|
|
||||||
rfk->rfkill = NULL;
|
rfk->rfkill = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue