[ovs-dev] [PATCH 2/4] veth: Fix problems removing veth devices
Justin Pettit
jpettit at nicira.com
Wed Apr 14 07:31:23 UTC 2010
When a user tried to delete a veth device through sysfs, the driver
wasn't properly parsing the device name. Also, it called
dev_get_by_name(), which increments a refcount on the device, but didn't
make a dev_put() before trying to delete it.
---
datapath/linux-2.6/compat-2.6/veth.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/datapath/linux-2.6/compat-2.6/veth.c b/datapath/linux-2.6/compat-2.6/veth.c
index e609c62..55cabf1 100644
--- a/datapath/linux-2.6/compat-2.6/veth.c
+++ b/datapath/linux-2.6/compat-2.6/veth.c
@@ -392,6 +392,7 @@ static void veth_dellink(struct net_device *dev)
if (!list_empty(&priv->list))
list_del(&priv->list);
+ dev_put(dev);
unregister_netdevice(dev);
unregister_netdevice(peer);
}
@@ -454,10 +455,13 @@ static ssize_t veth_store_veth_pairs(struct class *cls, const char *buffer,
rtnl_unlock();
return retval ? retval : count;
} else if (c == '-') {
+ char devname[IFNAMSIZ + 1] = "";
struct net_device *dev;
+ strncat(devname, buffer,
+ min_t(int, sizeof devname, strcspn(buffer, "\n")));
rtnl_lock();
- dev = dev_get_by_name(buffer);
+ dev = dev_get_by_name(devname);
if (!dev)
retval = -ENODEV;
else if (dev->init != veth_dev_init)
--
1.7.0.3
More information about the dev
mailing list