Patchwork [1/2] pxa168_eth: fix race in transmit path.

login
register
mail settings
Submitter Richard Cochran
Date June 20, 2011, 7:48 a.m.
Message ID <180237f9f567de29068e51b1442629509bb03e43.1308555865.git.richard.cochran@omicron.at>
Download mbox | patch
Permalink /patch/101041/
State Accepted
Delegated to: David Miller
Headers show

Comments

Richard Cochran - June 20, 2011, 7:48 a.m.
Because the socket buffer is freed in the completion interrupt, it is not
safe to access it after submitting it to the hardware.

Cc: stable@kernel.org
Cc: Sachin Sanap <ssanap@marvell.com>
Cc: Zhangfei Gao <zgao6@marvell.com>
Cc: Philip Rakity <prakity@marvell.com>
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
 drivers/net/pxa168_eth.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Eric Dumazet - June 20, 2011, 3:49 p.m.
Le lundi 20 juin 2011 à 09:48 +0200, Richard Cochran a écrit :
> Because the socket buffer is freed in the completion interrupt, it is not
> safe to access it after submitting it to the hardware.
> 
> Cc: stable@kernel.org
> Cc: Sachin Sanap <ssanap@marvell.com>
> Cc: Zhangfei Gao <zgao6@marvell.com>
> Cc: Philip Rakity <prakity@marvell.com>
> Signed-off-by: Richard Cochran <richard.cochran@omicron.at>

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - June 20, 2011, 9:02 p.m.
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 20 Jun 2011 17:49:17 +0200

> Le lundi 20 juin 2011 à 09:48 +0200, Richard Cochran a écrit :
>> Because the socket buffer is freed in the completion interrupt, it is not
>> safe to access it after submitting it to the hardware.
>> 
>> Cc: stable@kernel.org
>> Cc: Sachin Sanap <ssanap@marvell.com>
>> Cc: Zhangfei Gao <zgao6@marvell.com>
>> Cc: Philip Rakity <prakity@marvell.com>
>> Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
> 
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/pxa168_eth.c b/drivers/net/pxa168_eth.c
index 89f7540..5f597ca 100644
--- a/drivers/net/pxa168_eth.c
+++ b/drivers/net/pxa168_eth.c
@@ -1273,7 +1273,7 @@  static int pxa168_eth_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	wmb();
 	wrl(pep, SDMA_CMD, SDMA_CMD_TXDH | SDMA_CMD_ERD);
 
-	stats->tx_bytes += skb->len;
+	stats->tx_bytes += length;
 	stats->tx_packets++;
 	dev->trans_start = jiffies;
 	if (pep->tx_ring_size - pep->tx_desc_count <= 1) {