netpoll: fix a missing dev refcounting
authorCong Wang <amwang@redhat.com>
Thu, 17 Jan 2013 04:21:08 +0000 (12:21 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 17 Jan 2013 04:33:06 +0000 (23:33 -0500)
__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>
net/core/netpoll.c

index a5ad1c1c4b18d3d379010ee683d2cb4392b396fd..a9b10048388a31ebe3fd1c899a4c36a71534ab82 100644 (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);