b43: Fix locking FIXME in beacon update top half
PATCH 1/1 b43: Fix locking FIXME in beacon update top half
b43 has a FIXME about locking in the mac80211 set-beacon-int callback for a long time. As it turns out there actually is a tiny race window that could result in a use-after-free bug of the 'current_beacon' memory.
Nobody ever reported this, so it probably never happened.
Fix this by adding a spin lock that protects the current_beacon access. We must not be in atomic context while accessing hardware (due to SDIO), so the beacon update bottom half has to clone the skb and release the lock before writing it to hardware.
Let's all hope that this stops the troll who is trying to submit incorrect fixes for this issue repeatedly.
And let's hope that I'm not a troll, too, who just hides even more evil code in an even more complex attempt to fix the issue.
---
drivers/net/wireless/b43/b43.h +1 -0
@@ -941,6 +941,7 @@ struct b43_wl {bool beacon1_uploaded;bool beacon_templates_virgin;/* Never wrote the templates? */ struct work_struct beacon_update_trigger; +spinlock_t beacon_lock;/* The current QOS parameters for the 4 queues. */ struct b43_qos_params qos_params[B43_QOS_QUEUE_NUM ];
drivers/net/wireless/b43/main.c +32 -11
88 lines not on this page · raw message
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/b43-dev/attachments/20150126/49c944c0/attachment-0001.sig>
Kalle Valo
AppliedQuoted 11 lines
b43 has a FIXME about locking in the mac80211 set-beacon-int callback for a long time. As it turns out there actually is a tiny race window that could result in a use-after-free bug of the '
current_beacon' memory.
Nobody ever reported this, so it probably never happened.Fix this by adding a spin lock that protects the
current_beaconaccess. We must not be in atomic context while accessing hardware (due to SDIO), so the beacon update bottom half has to clone the skb and release the lock before writing it to hardware.
Quoted 7 lines
Let's all hope that this stops the troll who is trying to submit incorrect fixes for this issue repeatedly.
And let's hope that I'm not a troll, too, who just hides even more evil code in an even more complex attempt to fix the issue.Signed-off-by Michael Buesch <[email protected]>Tested-by Larry Finger <[email protected]>
Thanks, applied to wireless-drivers-next.git.
Kalle Valo