Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d4782c323d10d3698b71b6a6b3c7bdad33824658
Commit:     d4782c323d10d3698b71b6a6b3c7bdad33824658
Parent:     421c991483a6e52091cd2120c007cbc220d669ae
Author:     Patrick McHardy <[EMAIL PROTECTED]>
AuthorDate: Sun Jan 20 17:24:29 2008 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Sun Jan 20 20:31:45 2008 -0800

    [AF_KEY]: Fix skb leak on pfkey_send_migrate() error
    
    Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/key/af_key.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/net/key/af_key.c b/net/key/af_key.c
index 26d5e63..76dcd88 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -3593,27 +3593,29 @@ static int pfkey_send_migrate(struct xfrm_selector 
*sel, u8 dir, u8 type,
                /* old ipsecrequest */
                int mode = pfkey_mode_from_xfrm(mp->mode);
                if (mode < 0)
-                       return -EINVAL;
+                       goto err;
                if (set_ipsecrequest(skb, mp->proto, mode,
                                     (mp->reqid ?  IPSEC_LEVEL_UNIQUE : 
IPSEC_LEVEL_REQUIRE),
                                     mp->reqid, mp->old_family,
-                                    &mp->old_saddr, &mp->old_daddr) < 0) {
-                       return -EINVAL;
-               }
+                                    &mp->old_saddr, &mp->old_daddr) < 0)
+                       goto err;
 
                /* new ipsecrequest */
                if (set_ipsecrequest(skb, mp->proto, mode,
                                     (mp->reqid ? IPSEC_LEVEL_UNIQUE : 
IPSEC_LEVEL_REQUIRE),
                                     mp->reqid, mp->new_family,
-                                    &mp->new_saddr, &mp->new_daddr) < 0) {
-                       return -EINVAL;
-               }
+                                    &mp->new_saddr, &mp->new_daddr) < 0)
+                       goto err;
        }
 
        /* broadcast migrate message to sockets */
        pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL);
 
        return 0;
+
+err:
+       kfree_skb(skb);
+       return -EINVAL;
 }
 #else
 static int pfkey_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to