netpoll: use the net namespace of current process instead of init_net
authorCong Wang <amwang@redhat.com>
Sun, 27 Jan 2013 15:55:21 +0000 (15:55 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2013 23:32:55 +0000 (18:32 -0500)
This will allow us to setup netconsole in a different namespace
rather than where init_net is.

Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/netpoll.c

index a6f39b6..331ccb9 100644 (file)
@@ -1049,8 +1049,10 @@ int netpoll_setup(struct netpoll *np)
        int err;
 
        rtnl_lock();
-       if (np->dev_name)
-               ndev = __dev_get_by_name(&init_net, np->dev_name);
+       if (np->dev_name) {
+               struct net *net = current->nsproxy->net_ns;
+               ndev = __dev_get_by_name(net, np->dev_name);
+       }
        if (!ndev) {
                np_err(np, "%s doesn't exist, aborting\n", np->dev_name);
                err = -ENODEV;