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 A66B135C682; Tue, 21 Jul 2026 22:06:43 +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=1784671604; cv=none; b=uWMXnqbwfzFZT3wZ7C+w5EHyz1NQyrQIpdUxVleZ4Py/QifEVi4JHNz6SvGT7qhaZbhfebjXBYry98zFCzNxLw+6qtauhcORjc5inljO0zi44MS7Tlb9eB9ELJNyxdoPHvsWojbobkcKeDzRJdWKgeLiyFZW/y91wv64SelmhyI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784671604; c=relaxed/simple; bh=XHb8l2fRaophKp4gVJzO6VGPByJFYAGpfMp/sVGdX5A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a0ciHRR2D+ZEpvPViqNNt2aipoR/PXfu5kFWpR2DUMM5PGF/idkj5erUaBtm4bJHgVLyPdO+W78UN6Orq96phwRkBqxJz5AKbRN3+O94TvKLCONKHdqFMHUOGS7RwsYT6K0rBZ2EziM3cxs9z89FOMs7K9UdmChRdsFdjnR4Gvw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HOqYehRN; 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="HOqYehRN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 188B51F000E9; Tue, 21 Jul 2026 22:06:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784671603; bh=EXHICJhQeSDQB3+vuU5SQUN5OeumlpPYfqkrMmf3lD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HOqYehRNjclO02d59KT6i+liUlTMugxfVnr14Q7dz9CsaiUCZ3GLWZjpAQTUOCWPJ C+T2io+i+CEsrfHmQVpJfINj1HpmxYGINoTa/kd/fNystNquiM8HAKi8qR0cI+N9GD Beb3Rx8IZY0yUA+F3XS+f9bU1Wr4YAw9rwR8MGsk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tristan Madani , Loic Poulain , Jeff Johnson , Sasha Levin Subject: [PATCH 5.15 307/843] wifi: wcn36xx: fix OOB read from firmware count in PRINT_REG_INFO indication Date: Tue, 21 Jul 2026 17:19:02 +0200 Message-ID: <20260721152412.933297477@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152405.946368001@linuxfoundation.org> References: <20260721152405.946368001@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 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tristan Madani [ Upstream commit df2187acfca6c6cca372c5d35f42394d9c270b09 ] The firmware-controlled rsp->count field is used as the loop bound for indexing into the flexible rsp->regs[] array without validation against the message length. A count exceeding the actual data causes out-of- bounds reads from the heap-allocated message buffer. Add a check that count fits within the received message. Fixes: 43efa3c0f241 ("wcn36xx: Implement print_reg indication") Signed-off-by: Tristan Madani Reviewed-by: Loic Poulain Link: https://patch.msgid.link/20260421135018.352774-3-tristmd@gmail.com Signed-off-by: Jeff Johnson Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/wcn36xx/smd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index c056fae1d64183..a778e3e0599ee7 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2769,6 +2769,12 @@ static int wcn36xx_smd_print_reg_info_ind(struct wcn36xx *wcn, return -EIO; } + if (rsp->count > (len - sizeof(*rsp)) / sizeof(rsp->regs[0])) { + wcn36xx_warn("Truncated print reg info indication: count %u, len %zu\n", + rsp->count, len); + return -EIO; + } + wcn36xx_dbg(WCN36XX_DBG_HAL, "reginfo indication, scenario: 0x%x reason: 0x%x\n", rsp->scenario, rsp->reason); -- 2.53.0