diff options
author | Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> | 2008-12-15 02:16:22 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-15 02:16:22 -0500 |
commit | d8eb93078cedbbf4b7e18e1d7054171c7b70b442 (patch) | |
tree | 69f232bbdb2d2f214424deb74f7b1e3a96aad740 /net/xfrm/xfrm_user.c | |
parent | 8da73b73ef29d537ba09f29393cd68707833e746 (diff) |
xfrm: join error paths
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm/xfrm_user.c')
-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 |