From: Weiming Shi <bestswngs@gmail.com>
To: Kalle Valo <kvalo@kernel.org>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
Pontus Fuchs <pontus.fuchs@gmail.com>,
"John W. Linville" <linville@tuxdriver.com>,
co+a27ae3497f0074da@bugs.sh, Xiang Mei <xmei5@asu.edu>,
stable@vger.kernel.org
Subject: [PATCH wireless] wifi: ar5523: reject negative reply lengths
Date: Tue, 1 Sep 2026 03:15:02 +0800 [thread overview]
Message-ID: <20260831191502.3321906-1-bestswngs@gmail.com> (raw)
The reply length is supplied by the USB device as a 32-bit unsigned
integer, but ar5523_read_reply() stores it in an int. Values with bit 31
set become negative and bypass the existing signed upper-bound check.
memcpy() then converts the value to size_t and overruns the command's small
stack output buffer.
BUG: KASAN: out-of-bounds in ar5523_cmd_rx_cb
Read of size 18446744071562067968
Call Trace:
__asan_memcpy
ar5523_cmd_rx_cb
__usb_hcd_giveback_urb
usb_hcd_giveback_urb
dummy_timer
Kernel panic - not syncing: Fatal exception in interrupt
Reject negative lengths through the existing overflow error path.
Cc: stable@vger.kernel.org
Fixes: b7d572e1871d ("ar5523: Add new driver")
Reported-by: co+a27ae3497f0074da@bugs.sh
Closes: https://lore.kernel.org/all/K9HvthWDvq4gyjBVMeGsnsvA26mYMZ9v4gW7%40bugs.sh/
Assisted-by: Claude:gpt-5
Signed-off-by: Weiming Shi <bestswngs@gmail.com>
---
drivers/net/wireless/ath/ar5523/ar5523.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c
index 66ac396858a5..176e5de6a64e 100644
--- a/drivers/net/wireless/ath/ar5523/ar5523.c
+++ b/drivers/net/wireless/ath/ar5523/ar5523.c
@@ -73,7 +73,7 @@ static void ar5523_read_reply(struct ar5523 *ar, struct ar5523_cmd_hdr *hdr,
olen = 0;
if (cmd->odata) {
- if (cmd->olen < olen) {
+ if (olen < 0 || cmd->olen < olen) {
ar5523_err(ar, "olen too small %d < %d\n",
cmd->olen, olen);
cmd->olen = 0;
--
2.55.0
reply other threads:[~2026-08-31 19:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260831191502.3321906-1-bestswngs@gmail.com \
--to=bestswngs@gmail.com \
--cc=co+a27ae3497f0074da@bugs.sh \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=pontus.fuchs@gmail.com \
--cc=stable@vger.kernel.org \
--cc=xmei5@asu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®