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 4A4F3427A10; Tue, 21 Jul 2026 19:17:53 +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=1784661476; cv=none; b=oW8eYsW2QtIAka8RQrdzkDW/gu+YsUkXw4Ur61ehxqWnqEHO60x49CpRgBp34huhuB7l0Wnd/8ysF5mfqEVTcLxZGmBZ2cs9SzQzQH3dGDz4JbmnMhAGSWSVc0Tl90Bxb/ZGyTCQuqI3I6gD7tJCT4G3zanusZmO1fYy9Creiec= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784661476; c=relaxed/simple; bh=OV9vyiwp5d6hqrKIllR7fEOGVtKn/NrwsMpvXAQ/KuI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ban+rzOKPhg6PG9wNvERgfqkushOoSZ1KEhglHT+Bv0vUgoHU71tLhxI2muiT8pFSijnh8lRkoOhLn9JEQiwWoi1FMwx7rtVnuYsM3HT4zxsVnmktcVYfO/NqgO/lHoy4P5r3ojc1otUbHOh3LmksOLgmGO8z11IsjoVfgSBRc4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=omUdlU/0; 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="omUdlU/0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EACEB1F00A3A; Tue, 21 Jul 2026 19:17:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784661473; bh=qJJpOEcbrf41zizz7ARzqt+ganGHKpgH6hyQD6pkebI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=omUdlU/00CpdYaSXbCbfdHjqgsTxPZYQf4RH2CZuhcNjRljDjqoyGopPTGnBbcush xCGyNTVxwFUeNsz3v8wLMsZjieZKbfIGpLf2d0jP/owMP4oU6nGpmEcaVINgZCyFtd eA6SSTXBc49zrP6PHBRH9UQ61SQcMc3m9iiXRLIM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tristan Madani , Ping-Ke Shih , Sasha Levin Subject: [PATCH 6.12 0079/1276] wifi: rtw88: fix OOB read from firmware RX descriptor exceeding DMA buffer Date: Tue, 21 Jul 2026 17:08:42 +0200 Message-ID: <20260721152447.862281301@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152446.065700225@linuxfoundation.org> References: <20260721152446.065700225@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 6e76e9ed273dfb4b3333a5ebbb94958cc5752ab6 ] In rtw_pci_rx_napi(), new_len is computed as the sum of pkt_len (14-bit descriptor field, max 16383) and pkt_offset (drv_info_sz + shift, both firmware-controlled). The result can exceed RTK_PCI_RX_BUF_SIZE (11478), causing an out-of-bounds read from the pre-allocated DMA buffer when skb_put_data copies new_len bytes. The USB transport already validates this (rtw_usb_rx_data_put checks against RTW_USB_MAX_RECVBUF_SZ); the PCIe path does not. Add a check that new_len does not exceed the DMA buffer size. Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver") Signed-off-by: Tristan Madani Signed-off-by: Ping-Ke Shih Link: https://patch.msgid.link/20260421111434.3389674-1-tristmd@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtw88/pci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c index 7e33518ce311e8..f58a5a1a083c04 100644 --- a/drivers/net/wireless/realtek/rtw88/pci.c +++ b/drivers/net/wireless/realtek/rtw88/pci.c @@ -1076,6 +1076,11 @@ static u32 rtw_pci_rx_napi(struct rtw_dev *rtwdev, struct rtw_pci *rtwpci, * discard the frame if none available */ new_len = pkt_stat.pkt_len + pkt_offset; + if (unlikely(new_len > RTK_PCI_RX_BUF_SIZE)) { + rtw_dbg(rtwdev, RTW_DBG_RX, + "oversized RX packet: %u\n", new_len); + goto next_rp; + } new = dev_alloc_skb(new_len); if (WARN_ONCE(!new, "rx routine starvation\n")) goto next_rp; -- 2.53.0