Skip to content

Commit

Permalink
netpoll: use the net namespace of current process instead of init_net
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Cong Wang authored and David S. Miller committed Jan 28, 2013
1 parent faeed82 commit 556e625
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/core/netpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 556e625

Please sign in to comment.