[XFRM] xfrm_user: Fix return values of xfrm_add_sa_expire.
As noted by Kent Yoder, this function will always return an error. Make sure it returns zero on success. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -1557,14 +1557,13 @@ static int xfrm_add_sa_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|||||||
struct xfrm_usersa_info *p = &ue->state;
|
struct xfrm_usersa_info *p = &ue->state;
|
||||||
|
|
||||||
x = xfrm_state_lookup(&p->id.daddr, p->id.spi, p->id.proto, p->family);
|
x = xfrm_state_lookup(&p->id.daddr, p->id.spi, p->id.proto, p->family);
|
||||||
err = -ENOENT;
|
|
||||||
|
|
||||||
|
err = -ENOENT;
|
||||||
if (x == NULL)
|
if (x == NULL)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err = -EINVAL;
|
|
||||||
|
|
||||||
spin_lock_bh(&x->lock);
|
spin_lock_bh(&x->lock);
|
||||||
|
err = -EINVAL;
|
||||||
if (x->km.state != XFRM_STATE_VALID)
|
if (x->km.state != XFRM_STATE_VALID)
|
||||||
goto out;
|
goto out;
|
||||||
km_state_expired(x, ue->hard, current->pid);
|
km_state_expired(x, ue->hard, current->pid);
|
||||||
@@ -1574,6 +1573,7 @@ static int xfrm_add_sa_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|||||||
xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
|
xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
|
||||||
AUDIT_MAC_IPSEC_DELSA, 1, NULL, x);
|
AUDIT_MAC_IPSEC_DELSA, 1, NULL, x);
|
||||||
}
|
}
|
||||||
|
err = 0;
|
||||||
out:
|
out:
|
||||||
spin_unlock_bh(&x->lock);
|
spin_unlock_bh(&x->lock);
|
||||||
xfrm_state_put(x);
|
xfrm_state_put(x);
|
||||||
|
Reference in New Issue
Block a user