linux/drivers/net/ethernet/marvell/mvpp2
Dmitriy Okunev 14cb1e7702 net: mvpp2: prevent buffer overflow in page_pool allocation
The per‑processor buffering scheme is supported only if the
number of pools (nrxqs * 2) does not exceed MVPP2_BM_MAX_POOLS (8).
This is already checked in mvpp2_probe() during the initial
activation of percpu_pools.

However, mvpp2_change_mtu() may later call
mvpp2_bm_switch_buffers(priv, true) without this check, which can
lead to an out-of-bounds access in the priv->page_pool array in
mvpp2_bm_init(). The array is sized to hold MVPP2_PORT_MAX_RXQ
entries, and mvpp2_get_nrxqs() may return exactly that value. The
per-CPU scheme then doubles it to nrxqs * 2, exceeding the array
bounds.

Check that the hardware version is MVPP22 or newer and that the
number of pools (nrxqs * 2) does not exceed MVPP2_BM_MAX_POOLS
before switching to per-CPU mode.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 7d04b0b13b ("mvpp2: percpu buffers")
Signed-off-by: Dmitriy Okunev <dokunevdmitriy@gmail.com>
Link: https://patch.msgid.link/20260914091557.71769-1-dokunevdmitriy@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-09-17 14:43:29 +02:00
..
Makefile net: mvpp2: ptp: add TAI support 2020-09-09 14:22:42 -07:00
mvpp2_cls.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
mvpp2_cls.h eth: mvpp2: migrate to new RXFH callbacks 2025-06-18 13:19:00 -07:00
mvpp2_debugfs.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
mvpp2_main.c net: mvpp2: prevent buffer overflow in page_pool allocation 2026-09-17 14:43:29 +02:00
mvpp2_prs.c net: mvpp2: Prevent parser TCAM memory corruption 2025-04-02 16:26:26 -07:00
mvpp2_prs.h net: mvpp2: Add parsing support for different IPv4 IHL values 2021-04-16 15:29:40 -07:00
mvpp2_tai.c net: mvpp2: ptp: add support for receive timestamping 2020-09-09 14:22:42 -07:00
mvpp2.h net: mvpp2: Prevent parser TCAM memory corruption 2025-04-02 16:26:26 -07:00