netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Jeff Garzik <jeff@garzik.org>
Cc: NetDev <netdev@vger.kernel.org>, Keir Fraser <keir@xensource.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] xen-netfront: Avoid deref'ing skbafter it is potentially freed.
Date: Mon, 13 Aug 2007 12:54:37 -0700	[thread overview]
Message-ID: <46C0B6FD.7020701@goop.org> (raw)

xennet_tx_bug_gc can free the skb before we use it, so make sure we don't.

Jeff, this is -rc material.

Signed-off-by: Keir Fraser <keir@xensource.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Jeff Garzik <jeff@garzik.org>

diff -r 8bfc43f6d1b0 drivers/net/xen-netfront.c
--- a/drivers/net/xen-netfront.c	Tue Aug 07 14:26:30 2007 -0700
+++ b/drivers/net/xen-netfront.c	Mon Aug 13 09:39:15 2007 -0700
@@ -566,15 +566,16 @@ static int xennet_start_xmit(struct sk_b
 	if (notify)
 		notify_remote_via_irq(np->netdev->irq);
 
+	np->stats.tx_bytes += skb->len;
+	np->stats.tx_packets++;
+
+	/* Note: It is not safe to access skb after xennet_tx_buf_gc()! */
 	xennet_tx_buf_gc(dev);
 
 	if (!netfront_tx_slot_available(np))
 		netif_stop_queue(dev);
 
 	spin_unlock_irq(&np->tx_lock);
-
-	np->stats.tx_bytes += skb->len;
-	np->stats.tx_packets++;
 
 	return 0;
 



             reply	other threads:[~2007-08-13 19:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-13 19:54 Jeremy Fitzhardinge [this message]
2007-08-14  0:03 ` [PATCH] xen-netfront: Avoid deref'ing skbafter it is potentially freed Jesper Juhl
2007-08-14 18:16   ` Jeremy Fitzhardinge
2007-08-14  5:51 ` Jeff Garzik

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=46C0B6FD.7020701@goop.org \
    --to=jeremy@goop.org \
    --cc=jeff@garzik.org \
    --cc=keir@xensource.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.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).