Skip to content

Commit c3d7b90

Browse files
Tristan Madanigregkh
authored andcommitted
wifi: b43: enforce bounds check on firmware key index in b43_rx()
commit 1f4f78b upstream. The firmware-controlled key index in b43_rx() can exceed the dev->key[] array size (58 entries). The existing B43_WARN_ON is non-enforcing in production builds, allowing an out-of-bounds read. Make the B43_WARN_ON check enforcing by dropping the frame when the firmware returns an invalid key index. Suggested-by: Jonas Gorski <jonas.gorski@gmail.com> Acked-by: Michael Büsch <m@bues.ch> Fixes: e4d6b79 ("[B43]: add mac80211-based driver for modern BCM43xx devices") Cc: stable@vger.kernel.org Signed-off-by: Tristan Madani <tristan@talencesecurity.com> Link: https://patch.msgid.link/20260417111145.2694196-1-tristmd@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent fe75fa1 commit c3d7b90

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • drivers/net/wireless/broadcom/b43

drivers/net/wireless/broadcom/b43/xmit.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,8 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
702702
* key index, but the ucode passed it slightly different.
703703
*/
704704
keyidx = b43_kidx_to_raw(dev, keyidx);
705-
B43_WARN_ON(keyidx >= ARRAY_SIZE(dev->key));
705+
if (B43_WARN_ON(keyidx >= ARRAY_SIZE(dev->key)))
706+
goto drop;
706707

707708
if (dev->key[keyidx].algorithm != B43_SEC_ALGO_NONE) {
708709
wlhdr_len = ieee80211_hdrlen(fctl);

0 commit comments

Comments
 (0)