Commit 8048168d authored by Alexey Kodanev's avatar Alexey Kodanev Committed by Jakub Kicinski
Browse files

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 fa02de9e ("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: bba2556e ("net: stmmac: Enable RX via AF_XDP zero-copy")
Signed-off-by: default avatarAlexey Kodanev <aleksei.kodanev@bell-sw.com>
Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/20251126104327.175590-1-aleksei.kodanev@bell-sw.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent ebb2eaeb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5396,10 +5396,10 @@ static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue)
			len = 0;
		}

read_again:
		if (count >= limit)
			break;

read_again:
		buf1_len = 0;
		entry = next_entry;
		buf = &rx_q->buf_pool[entry];