xfrm: join error paths
authorIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
Mon, 15 Dec 2008 07:16:22 +0000 (23:16 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 15 Dec 2008 07:16:22 +0000 (23:16 -0800)
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/xfrm/xfrm_user.c

index 38ffaf33312e4055d032288e6bd85351e73769bc..b95a2d64eb59c3f86e066acc86fee8e2e7fb61e1 100644 (file)
@@ -1688,21 +1688,16 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh,
        int err = -ENOMEM;
 
        if (!x)
-               return err;
+               goto nomem;
 
        err = verify_newpolicy_info(&ua->policy);
-       if (err) {
-               printk("BAD policy passed\n");
-               kfree(x);
-               return err;
-       }
+       if (err)
+               goto bad_policy;
 
        /*   build an XP */
        xp = xfrm_policy_construct(net, &ua->policy, attrs, &err);
-       if (!xp) {
-               kfree(x);
-               return err;
-       }
+       if (!xp)
+               goto free_state;
 
        memcpy(&x->id, &ua->id, sizeof(ua->id));
        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);
 
        return 0;
+
+bad_policy:
+       printk("BAD policy passed\n");
+free_state:
+       kfree(x);
+nomem:
+       return err;
 }
 
 #ifdef CONFIG_XFRM_MIGRATE