Skip to contentSkip to conversation

net: stmmac: Premature loop termination check was ignored

PATCH Superseded Jochen Henneberg 3 participants 4 messages Feb 21, 2023

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: stmmac: Premature loop termination check was ignored

The premature loop termination check makes sense only in case of the jump to read_again where the count may have been updated. But read_again did not include the check.

---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -2
index 1a5b8dab5e9b..de98c009866a 100644
@@ -5031,10 +5031,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];
@@ -5221,10 +5221,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;
Signature · 6 lines
2.39.2

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw
Quoted 4 lines · Jochen Henneberg

The premature loop termination check makes sense only in case of the jump to read_again where the count may have been updated. But read_again did not include the check.

I think a fixes tag appropriate here.

Quoted 4 lines
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Code change makes sense to me.

Quoted 31 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -2
index 1a5b8dab5e9b..de98c009866a 100644
@@ -5031,10 +5031,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];
@@ -5221,10 +5221,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;
Signature · 1 line
2.39.2
#2 lore raw

The premature loop termination check makes sense only in case of the jump to read_again where the count may have been updated. But read_again did not include the check.

Fixes bba2556efad6 (net: stmmac: Enable RX via AF_XDP zero-copy)
Fixes ec222003bd94 (net: stmmac: Prepare to add Split Header support)

---
V2: Added fixes tags for both commits that introduced the issue

 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -2
index 1a5b8dab5e9b..de98c009866a 100644
@@ -5031,10 +5031,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];
@@ -5221,10 +5221,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;
Signature · 1 line
2.39.2
maintainer
#3 lore raw
Quoted 7 lines · On Tue, 21 Feb 2023 20:35:25 +0100 Jochen Henneberg wrote:

The premature loop termination check makes sense only in case of the jump to read_again where the count may have been updated. But read_again did not include the check.

Fixes bba2556efad6 (net: stmmac: Enable RX via AF_XDP zero-copy)
Fixes ec222003bd94 (net: stmmac: Prepare to add Split Header support)

Please repost separately, not as a reply. Patch tracking utilities will categorize emails with Re in the subject as comments rather than submissions.