diff options
author | Eric Dumazet <edumazet@google.com> | 2012-06-07 22:59:59 +0000 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2012-07-12 04:32:13 +0100 |
commit | 14be92503e6e67bce5c2c8259036b88f66cafc46 (patch) | |
tree | 438545c91d61a785804e907aa266d3aca2cf91d5 | |
parent | 2d3de9b3abd0b5ad7a2641a092e804f922cef31d (diff) | |
download | lwn-14be92503e6e67bce5c2c8259036b88f66cafc46.tar.gz lwn-14be92503e6e67bce5c2c8259036b88f66cafc46.zip |
be2net: fix a race in be_xmit()
[ Upstream commit cd8f76c0a0c6fce0b2cf23c9bd0123f91453f46d ]
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 5 |
1 files 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 bf266a00c774..36c7c4eb7ec0 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -696,6 +696,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; @@ -713,8 +715,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); |