xfrm: join error paths
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
8da73b73ef
commit
d8eb93078c
|
@ -1688,21 +1688,16 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh,
|
||||||
int err = -ENOMEM;
|
int err = -ENOMEM;
|
||||||
|
|
||||||
if (!x)
|
if (!x)
|
||||||
return err;
|
goto nomem;
|
||||||
|
|
||||||
err = verify_newpolicy_info(&ua->policy);
|
err = verify_newpolicy_info(&ua->policy);
|
||||||
if (err) {
|
if (err)
|
||||||
printk("BAD policy passed\n");
|
goto bad_policy;
|
||||||
kfree(x);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* build an XP */
|
/* build an XP */
|
||||||
xp = xfrm_policy_construct(net, &ua->policy, attrs, &err);
|
xp = xfrm_policy_construct(net, &ua->policy, attrs, &err);
|
||||||
if (!xp) {
|
if (!xp)
|
||||||
kfree(x);
|
goto free_state;
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(&x->id, &ua->id, sizeof(ua->id));
|
memcpy(&x->id, &ua->id, sizeof(ua->id));
|
||||||
memcpy(&x->props.saddr, &ua->saddr, sizeof(ua->saddr));
|
memcpy(&x->props.saddr, &ua->saddr, sizeof(ua->saddr));
|
||||||
|
@ -1727,6 +1722,13 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh,
|
||||||
kfree(xp);
|
kfree(xp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
bad_policy:
|
||||||
|
printk("BAD policy passed\n");
|
||||||
|
free_state:
|
||||||
|
kfree(x);
|
||||||
|
nomem:
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_XFRM_MIGRATE
|
#ifdef CONFIG_XFRM_MIGRATE
|
||||||
|
|
Loading…
Reference in New Issue