All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: Sachin Sant <sachinp@in.ibm.com>
Cc: netdev <netdev@vger.kernel.org>,
	serue@linux.vnet.ibm.com, David Miller <davem@davemloft.net>,
	matthltc@us.ibm.com, Stephen Hemminger <shemminger@vyatta.com>
Subject: Re: [2.6.30-git21] Network Namespace test failure
Date: Wed, 24 Jun 2009 22:38:47 -0500	[thread overview]
Message-ID: <20090625033847.GA27181@us.ibm.com> (raw)
In-Reply-To: <20090625031449.GA26767@us.ibm.com>

Quoting Serge E. Hallyn (serue@us.ibm.com):
> Quoting Sachin Sant (sachinp@in.ibm.com):
> > Serge E. Hallyn wrote:
> >> Precise kernel version and .config?
> >>   
> > Kernel version is 2.6.30-git21 (626f380d0b264a1e40237f5a2a3dffc5d14f256e)
> 
> Thanks.  I bisected it to commit
> ae0e8e82205c903978a79ebf5e31c670b61fa5b4 : "veth: prevent oops caused by
> netdev destructor".  That moves the free_percpu(priv->stats) from
> veth_dev_free to veth_close().  Since it gets allocated at
> veth_dev_init, and dveth_xmit uses it unconditionally, that seems like a
> likely cause of the oops?

Indeed the following patch fixes it on my end.  Sachin can you give
this one a shot?

thanks,
-serge

>From 7193023ad09dbc4b57909c0204c19ed93472cd9e Mon Sep 17 00:00:00 2001
From: root <root@elm3b203.beaverton.ibm.com>
Date: Wed, 24 Jun 2009 20:26:17 -0700
Subject: [PATCH 1/1] veth: don't free priv->status until dev->destructor

Since commit ae0e8e82205c903978a79ebf5e31c670b61fa5b4, priv->status
has been freed at veth_close().  But that causes a NULL deref at
veth_xmit.  This patch moves priv->status free back to the device
destructor.

Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
 drivers/net/veth.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 8e56fcf..6000aae 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -259,8 +259,6 @@ static int veth_close(struct net_device *dev)
 	netif_carrier_off(dev);
 	netif_carrier_off(priv->peer);
 
-	free_percpu(priv->stats);
-	priv->stats = NULL;
 	return 0;
 }
 
@@ -301,6 +299,15 @@ static const struct net_device_ops veth_netdev_ops = {
 	.ndo_set_mac_address = eth_mac_addr,
 };
 
+static void veth_dev_free(struct net_device *dev)
+{
+	struct veth_priv *priv;
+
+	priv = netdev_priv(dev);
+	free_percpu(priv->stats);
+	free_netdev(dev);
+}
+
 static void veth_setup(struct net_device *dev)
 {
 	ether_setup(dev);
@@ -308,7 +315,7 @@ static void veth_setup(struct net_device *dev)
 	dev->netdev_ops = &veth_netdev_ops;
 	dev->ethtool_ops = &veth_ethtool_ops;
 	dev->features |= NETIF_F_LLTX;
-	dev->destructor = free_netdev;
+	dev->destructor = veth_dev_free;
 }
 
 /*
-- 
1.6.2.3


  reply	other threads:[~2009-06-25  3:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-24 13:50 [2.6.30-git21] Network Namespace test failure Sachin Sant
2009-06-24 14:00 ` Serge E. Hallyn
2009-06-24 14:32   ` Sachin Sant
2009-06-25  3:14     ` Serge E. Hallyn
2009-06-25  3:38       ` Serge E. Hallyn [this message]
2009-06-25  3:46         ` Serge E. Hallyn
2009-06-25  5:38         ` Sachin Sant
2009-06-25  9:49         ` 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=20090625033847.GA27181@us.ibm.com \
    --to=serue@us.ibm.com \
    --cc=davem@davemloft.net \
    --cc=matthltc@us.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=sachinp@in.ibm.com \
    --cc=serue@linux.vnet.ibm.com \
    --cc=shemminger@vyatta.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.