net: Fix the rollback test in dev_change_name()
net: Fix the rollback test in dev_change_name() In dev_change_name() an err variable is used for storing the original call_netdevice_notifiers() errno (negative) and testing for a rollback error later, but the test for non-zero is wrong, because the err might have positive value as well - from dev_alloc_name(). It means the rollback for a netdevice with a number > 0 will never happen. (The err test is reordered btw. to make it more readable.) Signed-off-by: Jarek Poplawski <jarkao2@gmail.com> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e29d436317
commit
91e9c07bd6
@ -942,14 +942,15 @@ rollback:
|
|||||||
ret = notifier_to_errno(ret);
|
ret = notifier_to_errno(ret);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (err) {
|
/* err >= 0 after dev_alloc_name() or stores the first errno */
|
||||||
printk(KERN_ERR
|
if (err >= 0) {
|
||||||
"%s: name change rollback failed: %d.\n",
|
|
||||||
dev->name, ret);
|
|
||||||
} else {
|
|
||||||
err = ret;
|
err = ret;
|
||||||
memcpy(dev->name, oldname, IFNAMSIZ);
|
memcpy(dev->name, oldname, IFNAMSIZ);
|
||||||
goto rollback;
|
goto rollback;
|
||||||
|
} else {
|
||||||
|
printk(KERN_ERR
|
||||||
|
"%s: name change rollback failed: %d.\n",
|
||||||
|
dev->name, ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user