Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: stmmac: fix rx limit check in stmmac_rx_zc()

The extra "count >= limit" check in stmmac_rx_zc() is redundant and
has no effect because the value of "count" doesn't change after the
while condition at this point.

However, it can change after "read_again:" label:

while (count < limit) {
...

if (count >= limit)
break;
read_again:
...
/* XSK pool expects RX frame 1:1 mapped to XSK buffer */
if (likely(status & rx_not_ls)) {
xsk_buff_free(buf->xdp);
buf->xdp = NULL;
dirty++;
count++;
goto read_again;
}
...

This patch addresses the same issue previously resolved in stmmac_rx()
by commit fa02de9e7588 ("net: stmmac: fix rx budget limit check").
The fix is the same: move the check after the label to ensure that it
bounds the goto loop.

Fixes: bba2556efad6 ("net: stmmac: Enable RX via AF_XDP zero-copy")
Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/20251126104327.175590-1-aleksei.kodanev@bell-sw.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Alexey Kodanev and committed by
Jakub Kicinski
8048168d ebb2eaeb

+1 -1
+1 -1
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 5396 5396 len = 0; 5397 5397 } 5398 5398 5399 + read_again: 5399 5400 if (count >= limit) 5400 5401 break; 5401 5402 5402 - read_again: 5403 5403 buf1_len = 0; 5404 5404 entry = next_entry; 5405 5405 buf = &rx_q->buf_pool[entry];