]> xenbits.xensource.com Git - people/aperard/linux.git/commitdiff
net: stmmac: fix rx budget limit check
authorBaruch Siach <baruch@tkos.co.il>
Mon, 13 Nov 2023 17:42:49 +0000 (19:42 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 15 Nov 2023 03:48:02 +0000 (19:48 -0800)
The while loop condition verifies 'count < limit'. Neither value change
before the 'count >= limit' check. As is this check is dead code. But
code inspection reveals a code path that modifies 'count' and then goto
'drain_data' and back to 'read_again'. So there is a need to verify
count value sanity after 'read_again'.

Move 'read_again' up to fix the count limit check.

Fixes: ec222003bd94 ("net: stmmac: Prepare to add Split Header support")
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Link: https://lore.kernel.org/r/d9486296c3b6b12ab3a0515fcd47d56447a07bfc.1699897370.git.baruch@tkos.co.il
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index 3e50fd53a617440c3f417fd0ceea7209bca9dc1b..f28838c8cdb332555a5308feb359f081e5d1c7ec 100644 (file)
@@ -5328,10 +5328,10 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
                        len = 0;
                }
 
+read_again:
                if (count >= limit)
                        break;
 
-read_again:
                buf1_len = 0;
                buf2_len = 0;
                entry = next_entry;