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 EA46A44781C; Thu, 30 Jul 2026 15:34:20 +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=1785425662; cv=none; b=QtWkDbC3wLYHon5ZYrWf3Z5KHhVXfcQikv+WL0om4kPkBvZuPmcRKfU6cfEcRm3+LvshJ9N8vPWIJehu2I+u9MrBejs3pz2S1BHpajU2Cyc+DBlLtTVfJu3Mh8ULjz6mAEneXM6z5lpMogiMJTgO5ZcWq06UeIt90ZrmxgDOk/E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785425662; c=relaxed/simple; bh=suF6MjWO6ULMi+oVKkjn++1S1Z5BjNt3C7OWF95GqVc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mKrlKz9mfjMK+PXEkLupiLHMGLEL+LIFtaJ5oTdsuDi593AZBEGDKNspViNByWbEvtBNmbJw/TDbtTXYqzfJdlJIanHordTRwqdI0mxj41SQikZLxOkU/KUGrW7G4l5NFxviWt8TQ21asTY2RK3gkNQNBmKPUgskTqvz/cDLhFQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=PvO+tCbe; 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="PvO+tCbe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BCCD1F000E9; Thu, 30 Jul 2026 15:34:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785425660; bh=TjqMsOOQ7YFEnS6z8jYDSZn+kApkMLR6l1EjxggUq8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=PvO+tCbeeTRj5y3R7KnEQF0UQV2pPyZbU8/NqW6Nz7zDUNIMcHmf3LgG4eABV4B4M +DWue01+iC9YIRuf+nm9jDFAtEtZVrCQ0sOCzvT81tDGQpQdVGPTx8mttvNGOg3Kvz T2KQVcYUEPPTS38vtn0Eh+qoN5AYnfa3x0GbTXkI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tristan Madani , Christian Lamparter , Jeff Johnson , Sasha Levin Subject: [PATCH 6.12 148/602] wifi: carl9170: bound memcpy length in cmd callback to prevent OOB read Date: Thu, 30 Jul 2026 16:09:00 +0200 Message-ID: <20260730141439.089467282@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141435.976815864@linuxfoundation.org> References: <20260730141435.976815864@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-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tristan Madani [ Upstream commit 4cde55b2feff9504d1f993ab80e84e7ccb62791c ] 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: a84fab3cbfdc ("carl9170: 802.11 rx/tx processing and usb backend") Signed-off-by: Tristan Madani Acked-by: Christian Lamparter Closes: https://syzkaller.appspot.com/bug?extid=5c1ca6ccaa1215781cac Link: https://patch.msgid.link/20260421134929.325662-2-tristmd@gmail.com Signed-off-by: Jeff Johnson Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/carl9170/rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c index 908c4c8b7f8256..9a25c2a540b95f 100644 --- a/drivers/net/wireless/ath/carl9170/rx.c +++ b/drivers/net/wireless/ath/carl9170/rx.c @@ -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; } -- 2.53.0