Skip to content

Commit

Permalink
hp100: fix an skb->len race
Browse files Browse the repository at this point in the history
As soon as skb is given to hardware and spinlock released, TX completion
can free skb under us. Therefore, we should update netdev stats before
spinlock release.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jun 19, 2011
1 parent 00ce2d5 commit 658924d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/hp100.c
Original file line number Diff line number Diff line change
Expand Up @@ -1580,12 +1580,12 @@ static netdev_tx_t hp100_start_xmit_bm(struct sk_buff *skb,
hp100_outl(ringptr->pdl_paddr, TX_PDA_L); /* Low Prio. Queue */

lp->txrcommit++;
spin_unlock_irqrestore(&lp->lock, flags);

/* Update statistics */
dev->stats.tx_packets++;
dev->stats.tx_bytes += skb->len;

spin_unlock_irqrestore(&lp->lock, flags);

return NETDEV_TX_OK;

drop:
Expand Down

0 comments on commit 658924d

Please sign in to comment.