Patchwork netdev: change name dropping error codes

login
register
mail settings
Submitter stephen hemminger
Date Oct. 18, 2008, 4:30 a.m.
Message ID <20081017213006.385c45cd@extreme>
Download mbox | patch
Permalink /patch/4932/
State Accepted
Delegated to: David Miller
Headers show

Comments

stephen hemminger - Oct. 18, 2008, 4:30 a.m.
If changename notifier returns an error code, it gets incorrectly
cleared during rollback so the error is never returned to the user.
Found while testing similar code for MTU changes.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--
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
David Miller - Oct. 20, 2008, 6:34 a.m.
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Fri, 17 Oct 2008 21:30:06 -0700

> If changename notifier returns an error code, it gets incorrectly
> cleared during rollback so the error is never returned to the user.
> Found while testing similar code for MTU changes.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied, thanks Stephen.
--
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

Patch

--- a/net/core/dev.c	2008-10-17 18:59:11.000000000 -0700
+++ b/net/core/dev.c	2008-10-17 21:22:30.000000000 -0700
@@ -924,10 +924,10 @@  int dev_change_name(struct net_device *d
 		strlcpy(dev->name, newname, IFNAMSIZ);
 
 rollback:
-	err = device_rename(&dev->dev, dev->name);
-	if (err) {
+	ret = device_rename(&dev->dev, dev->name);
+	if (ret) {
 		memcpy(dev->name, oldname, IFNAMSIZ);
-		return err;
+		return ret;
 	}
 
 	write_lock_bh(&dev_base_lock);