From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDDB62EF652; Sat, 30 May 2026 18:31:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780165912; cv=none; b=L4zFVs5c71B4bkh3yo1Rye9fHULYRTbC8Yk9cbzj1eTSrcbw+bT5WSAO1aFORxXeF6hjJTox2n2zJLziXtErup+Bs7G/3gyn4YFhzE+LS9QAku246UnW8lLaditJ/xRhCIdi2DxRxitirO3lhez3tLX+B+SjW2bSrTC7gQ1kTN0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780165912; c=relaxed/simple; bh=vwXViF96yiaPfzlHg1dl4o4kOKeXUOSJQlJgPuvBg7g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gluK7NUUC5x50OkG72IZLQyI5EkBsNNdZuyWE3xnXQ6efjeN/L/2WYNVdUh9Hg6NTgouyVBkCUjHx4g25qCTAiDpMWp4ID2Jhgi3r27uGCjPrY8cmDkDw69B0z5RpdZG4k1FXEBf/sB9uFX3Hvc9DuRHooZc0r/0BDJkRdi+EI4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=iGSj6bWv; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="iGSj6bWv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBA461F00893; Sat, 30 May 2026 18:31:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780165911; bh=TJY7PIj72R8/qgb0pIpoD5c2likr3r9wjN9BWeMkiB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=iGSj6bWvHM1Wsyj83l9ZvV/vE/cHWvMek0yErbwym01/pWmGzLxA7jyTA14/I2bXZ FNzEn7XaONiFoHG43DCKlkFPL205l4JcfcMvjVb/BMQgsTmqzgjPbfN3068m7U7d+u cre+E8RQmW8FPTXA/+lsh+XnodCSgaa1O1Q9S++s= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jonas Gorski , =?UTF-8?q?Michael=20B=C3=BCsch?= , Tristan Madani , Johannes Berg Subject: [PATCH 5.10 219/589] wifi: b43: enforce bounds check on firmware key index in b43_rx() Date: Sat, 30 May 2026 18:01:40 +0200 Message-ID: <20260530160230.738034934@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160224.570625122@linuxfoundation.org> References: <20260530160224.570625122@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tristan Madani commit 1f4f78bf8549e6ac4f04fba4176854f3a6e0c332 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 Acked-by: Michael Büsch Fixes: e4d6b7951812 ("[B43]: add mac80211-based driver for modern BCM43xx devices") Cc: stable@vger.kernel.org Signed-off-by: Tristan Madani Link: https://patch.msgid.link/20260417111145.2694196-1-tristmd@gmail.com Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/broadcom/b43/xmit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/wireless/broadcom/b43/xmit.c +++ b/drivers/net/wireless/broadcom/b43/xmit.c @@ -702,7 +702,8 @@ void b43_rx(struct b43_wldev *dev, struc * key index, but the ucode passed it slightly different. */ keyidx = b43_kidx_to_raw(dev, keyidx); - B43_WARN_ON(keyidx >= ARRAY_SIZE(dev->key)); + if (B43_WARN_ON(keyidx >= ARRAY_SIZE(dev->key))) + goto drop; if (dev->key[keyidx].algorithm != B43_SEC_ALGO_NONE) { wlhdr_len = ieee80211_hdrlen(fctl);