netdevsim: don't leak devlink resources
authorJakub Kicinski <jakub.kicinski@netronome.com>
Wed, 25 Jul 2018 22:39:27 +0000 (15:39 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 26 Jul 2018 05:33:39 +0000 (22:33 -0700)
Devlink resources registered with devlink_resource_register() have
to be unregistered.

Fixes: 37923ed6b8ce ("netdevsim: Add simple FIB resource controller via devlink")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/netdevsim/devlink.c

index ba663e5af168bc4db3152f6a8fdaf85bf4753148..5135fc371f01ba27365b85c278b3c20b90e65c58 100644 (file)
@@ -207,6 +207,7 @@ void nsim_devlink_teardown(struct netdevsim *ns)
                struct net *net = nsim_to_net(ns);
                bool *reg_devlink = net_generic(net, nsim_devlink_id);
 
+               devlink_resources_unregister(ns->devlink, NULL);
                devlink_unregister(ns->devlink);
                devlink_free(ns->devlink);
                ns->devlink = NULL;