netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 1/2] net: stmmac: fix rx budget limit check
@ 2023-11-13 17:42 Baruch Siach
  2023-11-13 17:42 ` [PATCH net 2/2] net: stmmac: avoid rx queue overrun Baruch Siach
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Baruch Siach @ 2023-11-13 17:42 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu; +Cc: netdev, Baruch Siach

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>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 3e50fd53a617..f28838c8cdb3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -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;
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-11-15  4:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-13 17:42 [PATCH net 1/2] net: stmmac: fix rx budget limit check Baruch Siach
2023-11-13 17:42 ` [PATCH net 2/2] net: stmmac: avoid rx queue overrun Baruch Siach
2023-11-13 22:52   ` Jakub Kicinski
2023-11-14  8:08     ` Baruch Siach
2023-11-14 16:04   ` Serge Semin
2023-11-14 16:09     ` Baruch Siach
2023-11-14 11:25 ` [PATCH net 1/2] net: stmmac: fix rx budget limit check Serge Semin
2023-11-15  4:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).