diff options
Diffstat (limited to 'net/xfrm')
-rw-r--r-- | net/xfrm/xfrm_user.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 38ffaf33312e..b95a2d64eb59 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -1688,21 +1688,16 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1688 | int err = -ENOMEM; | 1688 | int err = -ENOMEM; |
1689 | 1689 | ||
1690 | if (!x) | 1690 | if (!x) |
1691 | return err; | 1691 | goto nomem; |
1692 | 1692 | ||
1693 | err = verify_newpolicy_info(&ua->policy); | 1693 | err = verify_newpolicy_info(&ua->policy); |
1694 | if (err) { | 1694 | if (err) |
1695 | printk("BAD policy passed\n"); | 1695 | goto bad_policy; |
1696 | kfree(x); | ||
1697 | return err; | ||
1698 | } | ||
1699 | 1696 | ||
1700 | /* build an XP */ | 1697 | /* build an XP */ |
1701 | xp = xfrm_policy_construct(net, &ua->policy, attrs, &err); | 1698 | xp = xfrm_policy_construct(net, &ua->policy, attrs, &err); |
1702 | if (!xp) { | 1699 | if (!xp) |
1703 | kfree(x); | 1700 | goto free_state; |
1704 | return err; | ||
1705 | } | ||
1706 | 1701 | ||
1707 | memcpy(&x->id, &ua->id, sizeof(ua->id)); | 1702 | memcpy(&x->id, &ua->id, sizeof(ua->id)); |
1708 | memcpy(&x->props.saddr, &ua->saddr, sizeof(ua->saddr)); | 1703 | 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, | |||
1727 | kfree(xp); | 1722 | kfree(xp); |
1728 | 1723 | ||
1729 | return 0; | 1724 | return 0; |
1725 | |||
1726 | bad_policy: | ||
1727 | printk("BAD policy passed\n"); | ||
1728 | free_state: | ||
1729 | kfree(x); | ||
1730 | nomem: | ||
1731 | return err; | ||
1730 | } | 1732 | } |
1731 | 1733 | ||
1732 | #ifdef CONFIG_XFRM_MIGRATE | 1734 | #ifdef CONFIG_XFRM_MIGRATE |