Skip to contentSkip to conversation

net: sh_eth: Fix receive packet "exceeded" condition in sh_eth_rx()

PATCH Superseded Yoshihiro Shimoda 2 participants 3 messages Jun 9, 2014

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net: sh_eth: Fix receive packet "exceeded" condition in sh_eth_rx()

This patch fixes the packet "exceeded" condition in sh_eth_rx() when RACT in an RX descriptor is not set and the "quota" is 0. Otherwise, kernel panic happens because the "&n->poll_list" is deleted twice in sh_eth_poll() which calls napi_complete() and net_rx_action().

---
 drivers/net/ethernet/renesas/sh_eth.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/ethernet/renesas/sh_eth.c +3 -5
index 08ed9a3..ad0b5bd 100644
@@ -1399,7 +1399,6 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
 	int entry = mdp->cur_rx % mdp->num_rx_ring;
 	int boguscnt = (mdp->dirty_rx + mdp->num_rx_ring) - mdp->cur_rx;
 	struct sk_buff *skb;
-	int exceeded = 0;
 	u16 pkt_len = 0;
 	u32 desc_status;
 
@@ -1411,10 +1410,9 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
 		if (--boguscnt < 0)
 			break;
 
-		if (*quota <= 0) {
-			exceeded = 1;
+		if (*quota <= 0)
 			break;
-		}
+
 		(*quota)--;
 
 		if (!(desc_status & RDFEND))
@@ -1508,7 +1506,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
 		sh_eth_write(ndev, EDRRR_R, EDRRR);
 	}
 
-	return exceeded;
+	return (*quota <= 0);
 }
 
 static void sh_eth_rcv_snd_disable(struct net_device *ndev)
Signature · 1 line
1.7.9.5
#1 lore raw

Hello.

Quoted 15 lines · Yoshihiro Shimoda

This patch fixes the packet "exceeded" condition in sh_eth_rx() when RACT in an RX descriptor is not set and the "quota" is 0. Otherwise, kernel panic happens because the "&n->poll_list" is deleted twice in sh_eth_poll() which calls napi_complete() and net_rx_action().

---
  drivers/net/ethernet/renesas/sh_eth.c |    8 +++-----
  1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/ethernet/renesas/sh_eth.c +0 -0
index 08ed9a3..ad0b5bd 100644

[...]

drivers/net/ethernet/renesas/sh_eth.c static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) · line 1509

Quoted 6 lines
drivers/net/ethernet/renesas/sh_eth.c +1 -1
@@ -1508,7 +1506,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
  		sh_eth_write(ndev, EDRRR_R, EDRRR);
  	}
 
-	return exceeded;
+	return (*quota <= 0);

Parens not needed here.

WBR, Sergei

#2 lore raw

Hello.

Quoted 20 lines · Sergei Shtylyov

Hello.

Quoted 15 lines · Yoshihiro Shimoda

This patch fixes the packet "exceeded" condition in sh_eth_rx() when RACT in an RX descriptor is not set and the "quota" is 0. Otherwise, kernel panic happens because the "&n->poll_list" is deleted twice in sh_eth_poll() which calls napi_complete() and net_rx_action().

---
  drivers/net/ethernet/renesas/sh_eth.c |    8 +++-----
  1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/ethernet/renesas/sh_eth.c +0 -0
index 08ed9a3..ad0b5bd 100644

[...]

Quoted 8 lines

drivers/net/ethernet/renesas/sh_eth.c static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) · line 1509

Quoted 6 lines
drivers/net/ethernet/renesas/sh_eth.c +1 -1
@@ -1508,7 +1506,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
          sh_eth_write(ndev, EDRRR_R, EDRRR);
      }
 
-    return exceeded;
+    return (*quota <= 0);

Parens not needed here.

Thank you for the point. I will remove the parens.

Best regards,
Yoshihiro Shimoda

Quoted 2 lines

WBR, Sergei