]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
netpoll: add net device refcount tracker to struct netpoll
authorEric Dumazet <edumazet@google.com>
Sun, 5 Dec 2021 04:22:17 +0000 (20:22 -0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 7 Dec 2021 00:06:02 +0000 (16:06 -0800)
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/netconsole.c
include/linux/netpoll.h
net/core/netpoll.c

index ccecba908ded61370f8fc408ea53aa1ff305aca3..ab8cd555102083c2f0179898681489b987afe5b0 100644 (file)
@@ -721,7 +721,7 @@ restart:
                                __netpoll_cleanup(&nt->np);
 
                                spin_lock_irqsave(&target_list_lock, flags);
-                               dev_put(nt->np.dev);
+                               dev_put_track(nt->np.dev, &nt->np.dev_tracker);
                                nt->np.dev = NULL;
                                nt->enabled = false;
                                stopped = true;
index e6a2d72e0dc7a6929d32a2e994f24719e073121e..bd19c4b91e31204e85d30884720b761116d5c036 100644 (file)
@@ -24,6 +24,7 @@ union inet_addr {
 
 struct netpoll {
        struct net_device *dev;
+       netdevice_tracker dev_tracker;
        char dev_name[IFNAMSIZ];
        const char *name;
 
index edfc0f8011f88a7d46d69e94c6343489369fa78c..db724463e7cd5089d85d8f75a77ad83bbece82dc 100644 (file)
@@ -776,7 +776,7 @@ put_noaddr:
        err = __netpoll_setup(np, ndev);
        if (err)
                goto put;
-
+       netdev_tracker_alloc(ndev, &np->dev_tracker, GFP_KERNEL);
        rtnl_unlock();
        return 0;
 
@@ -853,7 +853,7 @@ void netpoll_cleanup(struct netpoll *np)
        if (!np->dev)
                goto out;
        __netpoll_cleanup(np);
-       dev_put(np->dev);
+       dev_put_track(np->dev, &np->dev_tracker);
        np->dev = NULL;
 out:
        rtnl_unlock();