mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
net: lan969x: fix RX ring stall on frames from inactive ports
If the source port of a received frame does not map to an active port,
or build_skb() fails, lan969x_fdma_rx_get_frame() returns the page to
the page_pool and returns NULL, and the NAPI poll loop breaks without
advancing past the DB. The DB keeps its DONE bit, so every following
poll returns the same page to the page_pool again, and RX stops on all
ports.
Drop the frame and advance past the DB like for any other frame, and
replace the WARN_ON() with a ratelimited error, as the source port comes
from the hardware.
Confirmed on lan969x (EV23X71A) with a kernel modified to give received
frames an out-of-range source port, which stopped RX on all ports. The
fix was tested the same way: only the bad frames are dropped.
Fixes: d84ad2c0d8 ("net: lan969x: add FDMA implementation")
Reported-by: Zhang Hewei <[email protected]>
Closes: https://lore.kernel.org/netdev/[email protected]/
Signed-off-by: Daniel Machon <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
This commit is contained in:
committed by
Jakub Kicinski
parent
81d2cf1c6d
commit
1a47bc214d
@@ -113,8 +113,11 @@ static struct sk_buff *lan969x_fdma_rx_get_frame(struct sparx5 *sparx5,
|
||||
sparx5_ifh_parse(sparx5, page_address(page), &fi);
|
||||
port = fi.src_port < consts->n_ports ? sparx5->ports[fi.src_port] :
|
||||
NULL;
|
||||
if (WARN_ON(!port))
|
||||
if (!port) {
|
||||
dev_err_ratelimited(sparx5->dev, "Data on inactive port %d\n",
|
||||
fi.src_port);
|
||||
goto free_page;
|
||||
}
|
||||
|
||||
skb = build_skb(page_address(page), fdma->db_size);
|
||||
if (unlikely(!skb))
|
||||
@@ -258,10 +261,8 @@ int lan969x_fdma_napi_poll(struct napi_struct *napi, int weight)
|
||||
break;
|
||||
|
||||
skb = lan969x_fdma_rx_get_frame(sparx5, rx);
|
||||
if (!skb)
|
||||
break;
|
||||
|
||||
napi_gro_receive(&rx->napi, skb);
|
||||
if (skb)
|
||||
napi_gro_receive(&rx->napi, skb);
|
||||
|
||||
fdma_db_advance(fdma);
|
||||
counter++;
|
||||
|
||||
Reference in New Issue
Block a user