mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
wifi: carl9170: bound memcpy length in cmd callback to prevent OOB read
[ Upstream commit4cde55b2fe] When the firmware sends a command response with a length mismatch, carl9170_cmd_callback() logs the mismatch and calls carl9170_restart() but then falls through to memcpy(ar->readbuf, buffer + 4, len - 4). Since len comes from the firmware and can exceed ar->readlen, this copies more data than the readbuf was allocated for. Bound the memcpy to min(len - 4, ar->readlen) so that the response is still completed -- avoiding repeated restarts from queued garbage -- while preventing an overread past the response buffer. Fixes:a84fab3cbf("carl9170: 802.11 rx/tx processing and usb backend") Signed-off-by: Tristan Madani <tristan@talencesecurity.com> Acked-by: Christian Lamparter <chunkeey@gmail.com> Closes: https://syzkaller.appspot.com/bug?extid=5c1ca6ccaa1215781cac Link: https://patch.msgid.link/20260421134929.325662-2-tristmd@gmail.com Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
1c690f7c4c
commit
f74e34e663
@@ -150,7 +150,8 @@ static void carl9170_cmd_callback(struct ar9170 *ar, u32 len, void *buffer)
|
||||
spin_lock(&ar->cmd_lock);
|
||||
if (ar->readbuf) {
|
||||
if (len >= 4)
|
||||
memcpy(ar->readbuf, buffer + 4, len - 4);
|
||||
memcpy(ar->readbuf, buffer + 4,
|
||||
min_t(u32, len - 4, ar->readlen));
|
||||
|
||||
ar->readbuf = NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user