If a device is renamed and the original name is subsequently reused
for a new device, the following warning is generated:
sysctl duplicate entry: /net/mpls/conf/veth0//input
CPU: 3 PID: 1379 Comm: ip Not tainted 4.1.0-rc4+ #20
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.7.5-20140531_083030-gandalf 04/01/2014
81566aaf
81236279 88002f7d7f00 88000db336d8
88000db33698 0005 88002e046000 8800168c9280
Call Trace:
[81566aaf] ? dump_stack+0x40/0x50
[81236279] ? __register_sysctl_table+0x289/0x5a0
[a051a24f] ? mpls_dev_notify+0x1ff/0x300 [mpls_router]
[8108db7f] ? notifier_call_chain+0x4f/0x70
[81470e72] ? register_netdevice+0x2b2/0x480
[a0524748] ? veth_newlink+0x178/0x2d3 [veth]
[8147f84c] ? rtnl_newlink+0x73c/0x8e0
[8147f27a] ? rtnl_newlink+0x16a/0x8e0
[81459ff2] ? __kmalloc_reserve.isra.30+0x32/0x90
[8147ccfd] ? rtnetlink_rcv_msg+0x8d/0x250
[8145b027] ? __alloc_skb+0x47/0x1f0
[8149badb] ? __netlink_lookup+0xab/0xe0
[8147cc70] ? rtnetlink_rcv+0x30/0x30
[8149e7a0] ? netlink_rcv_skb+0xb0/0xd0
[8147cc64] ? rtnetlink_rcv+0x24/0x30
[8149df17] ? netlink_unicast+0x107/0x1a0
[8149e4be] ? netlink_sendmsg+0x50e/0x630
[8145209c] ? sock_sendmsg+0x3c/0x50
[81452beb] ? ___sys_sendmsg+0x27b/0x290
[811bd258] ? mem_cgroup_try_charge+0x88/0x110
[811bd5b6] ? mem_cgroup_commit_charge+0x56/0xa0
[811d7700] ? do_filp_open+0x30/0xa0
[8145336e] ? __sys_sendmsg+0x3e/0x80
[8156c3f2] ? system_call_fastpath+0x16/0x75
Fix this by unregistering the previous sysctl table (registered for
the path containing the original device name) and re-registering the
table for the path containing the new device name.
Fixes: 37bde79979c3 (mpls: Per-device enabling of packet input)
Reported-by: Scott Feldman sfel...@gmail.com
Signed-off-by: Robert Shearman rshea...@brocade.com
---
net/mpls/af_mpls.c | 11 +++
1 file changed, 11 insertions(+)
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index bff427f31924..1f93a5978f2a 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -564,6 +564,17 @@ static int mpls_dev_notify(struct notifier_block *this,
unsigned long event,
case NETDEV_UNREGISTER:
mpls_ifdown(dev);
break;
+ case NETDEV_CHANGENAME:
+ mdev = mpls_dev_get(dev);
+ if (mdev) {
+ int err;
+
+ mpls_dev_sysctl_unregister(mdev);
+ err = mpls_dev_sysctl_register(dev, mdev);
+ if (err)
+ return notifier_from_errno(err);
+ }
+ break;
}
return NOTIFY_OK;
}
--
2.1.4
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html