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:
[] ? dump_stack+0x40/0x50
[] ? __register_sysctl_table+0x289/0x5a0
[] ? mpls_dev_notify+0x1ff/0x300 [mpls_router]
[] ? notifier_call_chain+0x4f/0x70
[] ? register_netdevice+0x2b2/0x480
[] ? veth_newlink+0x178/0x2d3 [veth]
[] ? rtnl_newlink+0x73c/0x8e0
[] ? rtnl_newlink+0x16a/0x8e0
[] ? __kmalloc_reserve.isra.30+0x32/0x90
[] ? rtnetlink_rcv_msg+0x8d/0x250
[] ? __alloc_skb+0x47/0x1f0
[] ? __netlink_lookup+0xab/0xe0
[] ? rtnetlink_rcv+0x30/0x30
[] ? netlink_rcv_skb+0xb0/0xd0
[] ? rtnetlink_rcv+0x24/0x30
[] ? netlink_unicast+0x107/0x1a0
[] ? netlink_sendmsg+0x50e/0x630
[] ? sock_sendmsg+0x3c/0x50
[] ? ___sys_sendmsg+0x27b/0x290
[] ? mem_cgroup_try_charge+0x88/0x110
[] ? mem_cgroup_commit_charge+0x56/0xa0
[] ? do_filp_open+0x30/0xa0
[] ? __sys_sendmsg+0x3e/0x80
[] ? 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
Signed-off-by: Robert Shearman
---
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