From: Maxime Bizon <mbizon@freebox.fr>
To: Richard Cochran <richardcochran@gmail.com>
Cc: netdev@vger.kernel.org, David Miller <davem@davemloft.net>,
Eric Dumazet <eric.dumazet@gmail.com>,
stable@kernel.org, Lennert Buytenhek <buytenh@wantstofly.org>
Subject: Re: [PATCH 2/2] mv643xx_eth: fix race in trasmit path.
Date: Mon, 20 Jun 2011 16:07:58 +0200 [thread overview]
Message-ID: <1308578878.32446.31.camel@sakura.staff.proxad.net> (raw)
In-Reply-To: <25a379578b71bf01f3c77ac76a193d26554f9e0c.1308555865.git.richard.cochran@omicron.at>
On Mon, 2011-06-20 at 09:48 +0200, Richard Cochran wrote:
Hi Richard,
> Because the socket buffer is freed in the completion interrupt, it is not
> safe to access it after submitting it to the hardware.
I don't see why.
skb is freed from txq_reclaim() which grabs the tx queue lock before,
(hence the lockless __skb_queue_xxx() in both functions)
What am I missing ?
> Cc: stable@kernel.org
> Cc: Lennert Buytenhek <buytenh@wantstofly.org>
> Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
> ---
> drivers/net/mv643xx_eth.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
> index a5d9b1c..1b7d2c1 100644
> --- a/drivers/net/mv643xx_eth.c
> +++ b/drivers/net/mv643xx_eth.c
> @@ -859,7 +859,7 @@ no_csum:
> static netdev_tx_t mv643xx_eth_xmit(struct sk_buff *skb, struct net_device *dev)
> {
> struct mv643xx_eth_private *mp = netdev_priv(dev);
> - int queue;
> + int length, queue;
> struct tx_queue *txq;
> struct netdev_queue *nq;
>
> @@ -881,10 +881,12 @@ static netdev_tx_t mv643xx_eth_xmit(struct sk_buff *skb, struct net_device *dev)
> return NETDEV_TX_OK;
> }
>
> + length = skb->len;
> +
> if (!txq_submit_skb(txq, skb)) {
> int entries_left;
>
> - txq->tx_bytes += skb->len;
> + txq->tx_bytes += length;
> txq->tx_packets++;
>
> entries_left = txq->tx_ring_size - txq->tx_desc_count;
--
Maxime
next prev parent reply other threads:[~2011-06-20 14:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-20 7:48 [PATCH 0/2] fix tiny races in MAC drivers Richard Cochran
2011-06-20 7:48 ` [PATCH 1/2] pxa168_eth: fix race in transmit path Richard Cochran
2011-06-20 15:49 ` Eric Dumazet
2011-06-20 21:02 ` David Miller
2011-06-20 7:48 ` [PATCH 2/2] mv643xx_eth: fix race in trasmit path Richard Cochran
2011-06-20 14:07 ` Maxime Bizon [this message]
2011-06-20 16:31 ` Eric Dumazet
2011-06-20 15:49 ` Eric Dumazet
2011-06-20 16:33 ` Lennert Buytenhek
2011-06-20 17:19 ` Eric Dumazet
2011-06-20 17:21 ` Eric Dumazet
2011-06-21 23:00 ` David Miller
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=1308578878.32446.31.camel@sakura.staff.proxad.net \
--to=mbizon@freebox.fr \
--cc=buytenh@wantstofly.org \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=stable@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).