diff options
author | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2017-06-09 14:41:57 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-10 15:58:50 -0400 |
commit | 10d486a30c5944320915ace3be8c15a8be1215cb (patch) | |
tree | ac279bdfda6a5b3340383e7c541beaff2350fa0a /net/core/net_namespace.c | |
parent | 4a7f7bc6009fe8e66f4781868a0dc7abaab57628 (diff) | |
download | linux-10d486a30c5944320915ace3be8c15a8be1215cb.tar.bz2 |
netns: fix error code when the nsid is already used
When the user tries to assign a specific nsid, idr_alloc() is called with
the range [nsid, nsid+1]. If this nsid is already used, idr_alloc() returns
ENOSPC (No space left on device). In our case, it's better to return
EEXIST to make it clear that the nsid is not available.
CC: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/net_namespace.c')
-rw-r--r-- | net/core/net_namespace.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 1f60c180e2de..2178db8e47cd 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -642,6 +642,7 @@ static int rtnl_net_newid(struct sk_buff *skb, struct nlmsghdr *nlh, rtnl_net_notifyid(net, RTM_NEWNSID, err); err = 0; } else if (err == -ENOSPC && nsid >= 0) { + err = -EEXIST; NL_SET_BAD_ATTR(extack, tb[NETNSA_NSID]); NL_SET_ERR_MSG(extack, "The specified nsid is already used"); } |