netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] be2net: fix a race in be_xmit()
@ 2012-06-08  8:59 Eric Dumazet
  2012-06-08 10:06 ` Sathya.Perla
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2012-06-08  8:59 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Sathya Perla

From: Eric Dumazet <edumazet@google.com>

As soon as hardware is notified of a transmit, we no longer can assume
skb can be dereferenced, as TX completion might have freed the packet.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Sathya Perla <sathya.perla@emulex.com>
---
 drivers/net/ethernet/emulex/benet/be_main.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 08efd30..fdb50ce 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -736,6 +736,8 @@ static netdev_tx_t be_xmit(struct sk_buff *skb,
 
 	copied = make_tx_wrbs(adapter, txq, skb, wrb_cnt, dummy_wrb);
 	if (copied) {
+		int gso_segs = skb_shinfo(skb)->gso_segs;
+
 		/* record the sent skb in the sent_skb table */
 		BUG_ON(txo->sent_skb_list[start]);
 		txo->sent_skb_list[start] = skb;
@@ -753,8 +755,7 @@ static netdev_tx_t be_xmit(struct sk_buff *skb,
 
 		be_txq_notify(adapter, txq->id, wrb_cnt);
 
-		be_tx_stats_update(txo, wrb_cnt, copied,
-				skb_shinfo(skb)->gso_segs, stopped);
+		be_tx_stats_update(txo, wrb_cnt, copied, gso_segs, stopped);
 	} else {
 		txq->head = start;
 		dev_kfree_skb_any(skb);

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

* RE: [PATCH] be2net: fix a race in be_xmit()
  2012-06-08  8:59 [PATCH] be2net: fix a race in be_xmit() Eric Dumazet
@ 2012-06-08 10:06 ` Sathya.Perla
  2012-06-08 21:44   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Sathya.Perla @ 2012-06-08 10:06 UTC (permalink / raw)
  To: eric.dumazet, davem; +Cc: netdev


>-----Original Message-----
>From: Eric Dumazet <edumazet@google.com>
>
>As soon as hardware is notified of a transmit, we no longer can assume
>skb can be dereferenced, as TX completion might have freed the packet.
>
>Signed-off-by: Eric Dumazet <edumazet@google.com>
>Cc: Sathya Perla <sathya.perla@emulex.com>

Good catch. Thanks!
Acked-by: Sathya Perla <sathya.perla@emulex.com>

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

* Re: [PATCH] be2net: fix a race in be_xmit()
  2012-06-08 10:06 ` Sathya.Perla
@ 2012-06-08 21:44   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2012-06-08 21:44 UTC (permalink / raw)
  To: Sathya.Perla; +Cc: eric.dumazet, netdev

From: <Sathya.Perla@Emulex.Com>
Date: Fri, 8 Jun 2012 03:06:14 -0700

> 
>>-----Original Message-----
>>From: Eric Dumazet <edumazet@google.com>
>>
>>As soon as hardware is notified of a transmit, we no longer can assume
>>skb can be dereferenced, as TX completion might have freed the packet.
>>
>>Signed-off-by: Eric Dumazet <edumazet@google.com>
>>Cc: Sathya Perla <sathya.perla@emulex.com>
> 
> Good catch. Thanks!
> Acked-by: Sathya Perla <sathya.perla@emulex.com>

Applied.

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

end of thread, other threads:[~2012-06-08 21:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-08  8:59 [PATCH] be2net: fix a race in be_xmit() Eric Dumazet
2012-06-08 10:06 ` Sathya.Perla
2012-06-08 21:44   ` David Miller

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).