* [PATCH 5.10.y v2] net: mvpp2: limit XDP frame size to the RX buffer
@ 2026-11-26 6:02 Dickson Wu via B4 Relay
2026-11-27 17:01 ` Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: Dickson Wu via B4 Relay @ 2026-11-26 6:02 UTC (permalink / raw)
To: stable; +Cc: Til Kaiser, Paolo Abeni, netdev
From: Til Kaiser <mail@tk154.de>
commit f3c6aa078927e6fe8121c9c591ddee8716c5305a upstream.
mvpp2 has short and long BM pools, and short pool buffers can be smaller
than PAGE_SIZE. The XDP path nevertheless initializes every xdp_buff with
PAGE_SIZE as frame size.
XDP helpers use frame_sz to validate tail growth and to derive the hard
end of the data area. Advertising PAGE_SIZE for short buffers can let
bpf_xdp_adjust_tail() grow a packet past the real allocation, corrupting
memory or later tripping skb tailroom checks.
Initialize the XDP buffer with bm_pool->frag_size so XDP tailroom matches
the actual buffer backing the packet.
Fixes: 07dd0a7aae7f ("mvpp2: add basic XDP support")
Signed-off-by: Til Kaiser <mail@tk154.de>
Link: https://patch.msgid.link/20260607134943.21996-3-mail@tk154.de
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ adapted to 5.10: no xdp_init_buff() here, set xdp.frame_sz directly ]
Signed-off-by: Dickson Wu <dickson.wu@certik.com>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Changes in v2
v2: resent through a whitespace-safe path; v1 <CAFaZ9erzjfA3ogfym5X53zX6fW1kMTHcOnu7rMdkCeq=H64Qbg@mail.gmail.com> was damaged by my mail client and does not apply.
The backport and the test runs were prepared with AI coding tools
(OpenAI Codex agents, with review by Claude). I went over the result
before signing off.
5.10.y is the one stable branch still missing this. 5.15.y and newer
already took it. 5.10 has no xdp_init_buff() and mvpp2_rx() fills in
the xdp_buff by hand, so the change lands on the xdp.frame_sz
assignment instead. Same value, same spot.
Tested on v5.10.275:
- x86_64 allmodconfig (CONFIG_MVPP2=m) W=1 build of mvpp2_main.o,
base vs patched, no new warnings
- x86_64 defconfig with CONFIG_MVPP2=y builds and boots under QEMU/KVM
- I don't have mvpp2 hardware, so the XDP short pool path itself is
untested here. No existing selftest reaches it.
The other two fixes from the same upstream series, 5e8e2a9624df ("net:
mvpp2: refill RX buffers before XDP or skb use") and 77a6b90ce56b
("net: mvpp2: build skb from XDP-adjusted data on XDP_PASS"), aren't in
5.10.y either. This one doesn't depend on them, so it's on its own here.
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index cb0e319bc2f1..3e60d40b3f6f 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -3617,7 +3617,7 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
xdp.data_hard_start = data;
xdp.data = data + MVPP2_MH_SIZE + MVPP2_SKB_HEADROOM;
xdp.data_end = xdp.data + rx_bytes;
- xdp.frame_sz = PAGE_SIZE;
+ xdp.frame_sz = bm_pool->frag_size;
if (bm_pool->pkt_size == MVPP2_BM_SHORT_PKT_SIZE)
xdp.rxq = &rxq->xdp_rxq_short;
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-27 17:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 6:02 [PATCH 5.10.y v2] net: mvpp2: limit XDP frame size to the RX buffer Dickson Wu via B4 Relay
2026-11-27 17:01 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox