Subject: Re: netns: use a spin_lock to protect nsid management

From: Nicolas Dichtel <[email-masked]>
Date: Wed, 13 May 2015 13:37:21 +0200

Le 12/05/2015 19:52, Dan Carpenter a écrit :
> Hello Nicolas Dichtel,
>
> The patch 95f38411df05: "netns: use a spin_lock to protect nsid
> management" from May 7, 2015, leads to the following static checker
> warning:
>
> 	net/core/net_namespace.c:580 rtnl_net_newid()
> 	warn: inconsistent returns 'spin_lock:&nsid_lock'.
>
> net/core/net_namespace.c
>     565
>     566          spin_lock_irqsave(&nsid_lock, flags);
>     567          if (__peernet2id(net, peer) >= 0) {
>     568                  err = -EEXIST;
>     569                  goto out;
>
> I don't know if __peernet2id() unlocks on error but it can't possibly
> restore flags so this isn't right.
It's a bug. I will send a patch.

Thank you for the report.

Nicolas