Skip to content

Commit fdd4e51

Browse files
Tristan Madanigregkh
authored andcommitted
wifi: b43legacy: enforce bounds check on firmware key index in RX path
commit a035766 upstream. Same fix as b43: the firmware-controlled key index in b43legacy_rx() can exceed dev->max_nr_keys. The existing B43legacy_WARN_ON is non-enforcing in production builds, allowing an out-of-bounds read of dev->key[]. Make the check enforcing by dropping the frame for invalid indices. Fixes: 75388ac ("[B43LEGACY]: add mac80211-based driver for legacy BCM43xx devices") Cc: stable@vger.kernel.org Signed-off-by: Tristan Madani <tristan@talencesecurity.com> Link: https://patch.msgid.link/20260417111145.2694196-2-tristmd@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2a1b44e commit fdd4e51

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • drivers/net/wireless/broadcom/b43legacy

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,8 @@ void b43legacy_rx(struct b43legacy_wldev *dev,
476476
* key index, but the ucode passed it slightly different.
477477
*/
478478
keyidx = b43legacy_kidx_to_raw(dev, keyidx);
479-
B43legacy_WARN_ON(keyidx >= dev->max_nr_keys);
479+
if (B43legacy_WARN_ON(keyidx >= dev->max_nr_keys))
480+
goto drop;
480481

481482
if (dev->key[keyidx].algorithm != B43legacy_SEC_ALGO_NONE) {
482483
/* Remove PROTECTED flag to mark it as decrypted. */

0 commit comments

Comments
 (0)