]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
wifi: rtl818x: rtl8187: Fix potential buffer underflow in rtl8187_rx_cb()
authorSeungjin Bae <eeodqql09@gmail.com>
Tue, 18 Nov 2025 01:32:59 +0000 (20:32 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jan 2026 12:09:31 +0000 (13:09 +0100)
commit6a96bd0d94305fd04a6ac64446ec113bae289384
tree8f8fdd7b894a1ac9b34e8ccce3e38e4ef5356c7a
parent81f087859c97cdbe7b2b28cdb117c2221eab45b0
wifi: rtl818x: rtl8187: Fix potential buffer underflow in rtl8187_rx_cb()

[ Upstream commit b647d2574e4583c2e3b0ab35568f60c88e910840 ]

The rtl8187_rx_cb() calculates the rx descriptor header address
by subtracting its size from the skb tail pointer.
However, it does not validate if the received packet
(skb->len from urb->actual_length) is large enough to contain this
header.

If a truncated packet is received, this will lead to a buffer
underflow, reading memory before the start of the skb data area,
and causing a kernel panic.

Add length checks for both rtl8187 and rtl8187b descriptor headers
before attempting to access them, dropping the packet cleanly if the
check fails.

Fixes: 6f7853f3cbe4 ("rtl8187: change rtl8187_dev.c to support RTL8187B (part 2)")
Signed-off-by: Seungjin Bae <eeodqql09@gmail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20251118013258.1789949-2-eeodqql09@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c