netpoll: fix a missing dev refcounting

__dev_get_by_name() doesn't refcount the network device,
so we have to do this by ourselves. Noticed by Eric.

Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Cong Wang 2013-01-17 12:21:08 +08:00 committed by David S. Miller
parent 07f623d3b2
commit 5bd30d3987
1 changed files with 1 additions and 0 deletions

View File

@ -1056,6 +1056,7 @@ int netpoll_setup(struct netpoll *np)
err = -ENODEV;
goto unlock;
}
dev_hold(ndev);
if (netdev_master_upper_dev_get(ndev)) {
np_err(np, "%s is a slave device, aborting\n", np->dev_name);