--- x/net/core/net_namespace.c +++ y/net/core/net_namespace.c @@ -442,10 +442,6 @@ static void net_free(struct net *net) { if (refcount_dec_and_test(&net->passive)) { kfree(rcu_access_pointer(net->gen)); - - /* There should not be any trackers left there. */ - ref_tracker_dir_exit(&net->notrefcnt_tracker); - kmem_cache_free(net_cachep, net); } } @@ -656,6 +652,7 @@ static DECLARE_WORK(net_cleanup_work, cl void __put_net(struct net *net) { ref_tracker_dir_exit(&net->refcnt_tracker); + ref_tracker_dir_exit(&net->notrefcnt_tracker); /* Cleanup the network namespace in process context */ if (llist_add(&net->cleanup_list, &cleanup_list)) queue_work(netns_wq, &net_cleanup_work);