]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net: wwan: t7xx: fix potential skb->frags overflow in RX path
authorKery Qi <qikeyu2017@gmail.com>
Thu, 22 Jan 2026 17:04:01 +0000 (01:04 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sun, 25 Jan 2026 22:43:32 +0000 (14:43 -0800)
commitf0813bcd2d9d97fdbdf2efb9532ab03ae92e99e6
tree2d30e993696c0d011a2c423baa81c5146f0a12fc
parent1742272bd3fae6362301d0f11eb9db9030348afc
net: wwan: t7xx: fix potential skb->frags overflow in RX path

When receiving data in the DPMAIF RX path,
the t7xx_dpmaif_set_frag_to_skb() function adds
page fragments to an skb without checking if the number of
fragments has exceeded MAX_SKB_FRAGS. This could lead to a buffer overflow
in skb_shinfo(skb)->frags[] array, corrupting adjacent memory and
potentially causing kernel crashes or other undefined behavior.

This issue was identified through static code analysis by comparing with a
similar vulnerability fixed in the mt76 driver commit b102f0c522cf ("mt76:
fix array overflow on receiving too many fragments for a packet").

The vulnerability could be triggered if the modem firmware sends packets
with excessive fragments. While under normal protocol conditions (MTU 3080
bytes, BAT buffer 3584 bytes),
a single packet should not require additional
fragments, the kernel should not blindly trust firmware behavior.
Malicious, buggy, or compromised firmware could potentially craft packets
with more fragments than the kernel expects.

Fix this by adding a bounds check before calling skb_add_rx_frag() to
ensure nr_frags does not exceed MAX_SKB_FRAGS.

The check must be performed before unmapping to avoid a page leak
and double DMA unmap during device teardown.

Fixes: d642b012df70a ("net: wwan: t7xx: Add data path interface")
Signed-off-by: Kery Qi <qikeyu2017@gmail.com>
Link: https://patch.msgid.link/20260122170401.1986-2-qikeyu2017@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c