diff options
author | Stefano Brivio <stefano.brivio@polimi.it> | 2008-01-13 12:30:14 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-01-16 12:53:32 -0500 |
commit | a38db5b6219d88e2b48f07472c436b19b864f93c (patch) | |
tree | fc59602d35c56e3f34e303464639a2ae961aa6ba /drivers | |
parent | 8ff9d21ee2ac7eceeb6ba3da52c3472dcab435e4 (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/b43/rfkill.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c index 98cf70c5fd47..11f53cb1139e 100644 --- a/drivers/net/wireless/b43/rfkill.c +++ b/drivers/net/wireless/b43/rfkill.c | |||
@@ -138,8 +138,11 @@ void b43_rfkill_init(struct b43_wldev *dev) | |||
138 | rfk->rfkill->user_claim_unsupported = 1; | 138 | rfk->rfkill->user_claim_unsupported = 1; |
139 | 139 | ||
140 | rfk->poll_dev = input_allocate_polled_device(); | 140 | rfk->poll_dev = input_allocate_polled_device(); |
141 | if (!rfk->poll_dev) | 141 | if (!rfk->poll_dev) { |
142 | goto err_free_rfk; | 142 | rfkill_free(rfk->rfkill); |
143 | goto err_freed_rfk; | ||
144 | } | ||
145 | |||
143 | rfk->poll_dev->private = dev; | 146 | rfk->poll_dev->private = dev; |
144 | rfk->poll_dev->poll = b43_rfkill_poll; | 147 | rfk->poll_dev->poll = b43_rfkill_poll; |
145 | rfk->poll_dev->poll_interval = 1000; /* msecs */ | 148 | rfk->poll_dev->poll_interval = 1000; /* msecs */ |
@@ -175,8 +178,7 @@ err_unreg_rfk: | |||
175 | err_free_polldev: | 178 | err_free_polldev: |
176 | input_free_polled_device(rfk->poll_dev); | 179 | input_free_polled_device(rfk->poll_dev); |
177 | rfk->poll_dev = NULL; | 180 | rfk->poll_dev = NULL; |
178 | err_free_rfk: | 181 | err_freed_rfk: |
179 | rfkill_free(rfk->rfkill); | ||
180 | rfk->rfkill = NULL; | 182 | rfk->rfkill = NULL; |
181 | out_error: | 183 | out_error: |
182 | rfk->registered = 0; | 184 | rfk->registered = 0; |
@@ -195,6 +197,5 @@ void b43_rfkill_exit(struct b43_wldev *dev) | |||
195 | rfkill_unregister(rfk->rfkill); | 197 | rfkill_unregister(rfk->rfkill); |
196 | input_free_polled_device(rfk->poll_dev); | 198 | input_free_polled_device(rfk->poll_dev); |
197 | rfk->poll_dev = NULL; | 199 | rfk->poll_dev = NULL; |
198 | rfkill_free(rfk->rfkill); | ||
199 | rfk->rfkill = NULL; | 200 | rfk->rfkill = NULL; |
200 | } | 201 | } |