netns: fix unbalanced spin_lock on error
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Wed, 13 May 2015 11:43:09 +0000 (13:43 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 May 2015 02:36:31 +0000 (22:36 -0400)
Unlock was missing on error path.

Fixes: 95f38411df05 ("netns: use a spin_lock to protect nsid management")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/net_namespace.c

index cbee75f2fc2865a815b43af5e829a2b2807f8716..d2f42da9479ba9cee3f134e8a6b8786f3065be7a 100644 (file)
@@ -565,6 +565,7 @@ static int rtnl_net_newid(struct sk_buff *skb, struct nlmsghdr *nlh)
 
        spin_lock_irqsave(&nsid_lock, flags);
        if (__peernet2id(net, peer) >= 0) {
+               spin_unlock_irqrestore(&nsid_lock, flags);
                err = -EEXIST;
                goto out;
        }