Re: [2.6.30-git21] Network Namespace test failure

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Serge E. Hallyn
Date: Wednesday, June 24, 2009 - 8:38 pm

Quoting Serge E. Hallyn (serue@us.ibm.com):

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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[2.6.30-git21] Network Namespace test failure, Sachin Sant, (Wed Jun 24, 6:50 am)
Re: [2.6.30-git21] Network Namespace test failure, Serge E. Hallyn, (Wed Jun 24, 7:00 am)
Re: [2.6.30-git21] Network Namespace test failure, Sachin Sant, (Wed Jun 24, 7:32 am)
Re: [2.6.30-git21] Network Namespace test failure, Serge E. Hallyn, (Wed Jun 24, 8:14 pm)
Re: [2.6.30-git21] Network Namespace test failure, Serge E. Hallyn, (Wed Jun 24, 8:38 pm)
Re: [2.6.30-git21] Network Namespace test failure, Serge E. Hallyn, (Wed Jun 24, 8:46 pm)
Re: [2.6.30-git21] Network Namespace test failure, Sachin Sant, (Wed Jun 24, 10:38 pm)
Re: [2.6.30-git21] Network Namespace test failure, David Miller, (Thu Jun 25, 2:49 am)