Message ID | m1fwsbus25.fsf@fess.ebiederm.org |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: ebiederm@xmission.com (Eric W. Biederman) Date: Sat, 29 Jan 2011 16:57:22 -0800 > > Ed Swierk <eswierk@bigswitch.com> writes: >> On 2.6.35.7 >> ip link add link eth0 netns 9999 type macvlan >> where 9999 is a nonexistent PID triggers an oops and causes all network functions to hang: >> [10663.821898] BUG: unable to handle kernel NULL pointer dereference at 000000000000006d >> [10663.821917] IP: [<ffffffff8149c2fa>] __dev_alloc_name+0x9a/0x170 ... > This bug was introduced in: > commit 81adee47dfb608df3ad0b91d230fb3cef75f0060 > Author: Eric W. Biederman <ebiederm@aristanetworks.com> > Date: Sun Nov 8 00:53:51 2009 -0800 > > net: Support specifying the network namespace upon device creation. ... > Where apparently I forgot to add error handling to the path where we create > a new network device in a new network namespace, and pass in an invalid pid. > > Cc: stable@kernel.org > Reported-by: Ed Swierk <eswierk@bigswitch.com> > Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Applied, thanks Eric. -- 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
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index b2a718d..d84fef4 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1517,6 +1517,9 @@ replay: snprintf(ifname, IFNAMSIZ, "%s%%d", ops->kind); dest_net = rtnl_link_get_net(net, tb); + if (IS_ERR(dest_net)) + return PTR_ERR(dest_net); + dev = rtnl_create_link(net, dest_net, ifname, ops, tb); if (IS_ERR(dev))