xfrm: fix the return code when xfrm_*_register_afinfo failed
If xfrm_*_register_afinfo failed since xfrm_*_afinfo[afinfo->family] had the value, return the -EEXIST, not -ENOBUFS Signed-off-by: Li RongQing <roy.qing.li@gmail.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
This commit is contained in:
parent
800777026e
commit
f31e8d4f7b
|
@ -29,7 +29,7 @@ int xfrm_input_register_afinfo(struct xfrm_input_afinfo *afinfo)
|
|||
return -EAFNOSUPPORT;
|
||||
spin_lock_bh(&xfrm_input_afinfo_lock);
|
||||
if (unlikely(xfrm_input_afinfo[afinfo->family] != NULL))
|
||||
err = -ENOBUFS;
|
||||
err = -EEXIST;
|
||||
else
|
||||
rcu_assign_pointer(xfrm_input_afinfo[afinfo->family], afinfo);
|
||||
spin_unlock_bh(&xfrm_input_afinfo_lock);
|
||||
|
|
|
@ -2808,7 +2808,7 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
|
|||
return -EAFNOSUPPORT;
|
||||
spin_lock(&xfrm_policy_afinfo_lock);
|
||||
if (unlikely(xfrm_policy_afinfo[afinfo->family] != NULL))
|
||||
err = -ENOBUFS;
|
||||
err = -EEXIST;
|
||||
else {
|
||||
struct dst_ops *dst_ops = afinfo->dst_ops;
|
||||
if (likely(dst_ops->kmem_cachep == NULL))
|
||||
|
|
|
@ -1908,7 +1908,7 @@ int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo)
|
|||
return -EAFNOSUPPORT;
|
||||
spin_lock_bh(&xfrm_state_afinfo_lock);
|
||||
if (unlikely(xfrm_state_afinfo[afinfo->family] != NULL))
|
||||
err = -ENOBUFS;
|
||||
err = -EEXIST;
|
||||
else
|
||||
rcu_assign_pointer(xfrm_state_afinfo[afinfo->family], afinfo);
|
||||
spin_unlock_bh(&xfrm_state_afinfo_lock);
|
||||
|
|
Loading…
Reference in New Issue