Subject: Re: net-next: NULL pointer dereference on adding a net namespace and a system freeze

From: Steffen Klassert <[email-masked]>
Date: Wed, 12 Mar 2014 09:38:27 +0100

On Tue, Mar 11, 2014 at 03:30:29PM +0100, Jakub Kiciński wrote:
> 
> Tested with del_timer_sync and unregister_hotcpu_notifier:
> 
> void flow_cache_fini(struct net *net)
> {
> 	int i;
> 	struct flow_cache *fc = &net->xfrm.flow_cache_global;
> 
> 	unregister_hotcpu_notifier(&fc->hotcpu_notifier);
> 	del_timer_sync(&fc->rnd_timer);
> 
> 	for_each_possible_cpu(i) {
> 		struct flow_cache_percpu *fcp = per_cpu_ptr(fc->percpu, i);
> 		kfree(fcp->hash_table);
> 		fcp->hash_table = NULL;
> 	}
> 
> 	free_percpu(fc->percpu);
> 	fc->percpu = NULL;
> }
> EXPORT_SYMBOL(flow_cache_fini);
> 
> 
> Seems to solve both the freeze and the bug on restarting libvirtd/rtkit!
> 

Thanks a lot for testing!

I'll submit the updated patch now.