From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: richardcochran@gmail.com, netdev <netdev@vger.kernel.org>
Subject: [PATCH] hp100: fix an skb->len race
Date: Mon, 20 Jun 2011 00:43:33 +0200 [thread overview]
Message-ID: <1308523413.3539.97.camel@edumazet-laptop> (raw)
In-Reply-To: <20110619.120536.1593516819440469613.davem@davemloft.net>
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>
---
drivers/net/hp100.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index 8e10d2f..c3ecb11 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -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:
next prev parent reply other threads:[~2011-06-19 22:43 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-19 11:19 [PATCH 00/11] net: expand time stamping, batch #2 Richard Cochran
2011-06-19 11:19 ` [PATCH 01/11] net: export the receive time stamping hook for non-NAPI drivers Richard Cochran
2011-06-19 11:19 ` [PATCH 02/11] lib8390: enable transmit and receive time stamping Richard Cochran
2011-06-19 11:19 ` [PATCH 03/11] emaclite: " Richard Cochran
2011-06-19 11:53 ` Eric Dumazet
2011-06-19 11:20 ` [PATCH 04/11] ll_temac: " Richard Cochran
2011-06-19 11:20 ` [PATCH 05/11] fec_mpc52xx: " Richard Cochran
2011-06-19 11:56 ` Eric Dumazet
2011-06-19 11:20 ` [PATCH 06/11] macb: enable transmit " Richard Cochran
2011-06-19 11:56 ` Eric Dumazet
2011-06-19 11:20 ` [PATCH 07/11] fs_enet: " Richard Cochran
2011-06-19 11:58 ` Eric Dumazet
2011-06-19 18:12 ` Richard Cochran
2011-06-19 18:30 ` Eric Dumazet
2011-06-20 6:58 ` Richard Cochran
2011-06-22 23:56 ` Matt Carlson
2011-06-19 11:20 ` [PATCH 08/11] smsc911x: " Richard Cochran
2011-06-19 11:20 ` [PATCH 09/11] pxa168_eth: " Richard Cochran
2011-06-19 18:15 ` Richard Cochran
2011-06-19 11:20 ` [PATCH 10/11] mv643xx_eth: " Richard Cochran
2011-06-19 18:17 ` Richard Cochran
2011-06-19 18:33 ` Eric Dumazet
2011-06-19 19:05 ` David Miller
2011-06-19 22:43 ` Eric Dumazet [this message]
2011-06-19 23:34 ` [PATCH] hp100: fix an skb->len race David Miller
2011-06-19 11:20 ` [PATCH 11/11] ucc_geth: enable transmit time stamping Richard Cochran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1308523413.3539.97.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox