aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-01-20 20:24:29 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-20 23:31:45 -0500
commitd4782c323d10d3698b71b6a6b3c7bdad33824658 (patch)
tree5c2b4706135ab68f5690adbbe7480b627476608d /net
parent421c991483a6e52091cd2120c007cbc220d669ae (diff)
[AF_KEY]: Fix skb leak on pfkey_send_migrate() error
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/key/af_key.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 26d5e63c4cc5..76dcd882f87b 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,
3593 /* old ipsecrequest */ 3593 /* old ipsecrequest */
3594 int mode = pfkey_mode_from_xfrm(mp->mode); 3594 int mode = pfkey_mode_from_xfrm(mp->mode);
3595 if (mode < 0) 3595 if (mode < 0)
3596 return -EINVAL; 3596 goto err;
3597 if (set_ipsecrequest(skb, mp->proto, mode, 3597 if (set_ipsecrequest(skb, mp->proto, mode,
3598 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE), 3598 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE),
3599 mp->reqid, mp->old_family, 3599 mp->reqid, mp->old_family,
3600 &mp->old_saddr, &mp->old_daddr) < 0) { 3600 &mp->old_saddr, &mp->old_daddr) < 0)
3601 return -EINVAL; 3601 goto err;
3602 }
3603 3602
3604 /* new ipsecrequest */ 3603 /* new ipsecrequest */
3605 if (set_ipsecrequest(skb, mp->proto, mode, 3604 if (set_ipsecrequest(skb, mp->proto, mode,
3606 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE), 3605 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE),
3607 mp->reqid, mp->new_family, 3606 mp->reqid, mp->new_family,
3608 &mp->new_saddr, &mp->new_daddr) < 0) { 3607 &mp->new_saddr, &mp->new_daddr) < 0)
3609 return -EINVAL; 3608 goto err;
3610 }
3611 } 3609 }
3612 3610
3613 /* broadcast migrate message to sockets */ 3611 /* broadcast migrate message to sockets */
3614 pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL); 3612 pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL);
3615 3613
3616 return 0; 3614 return 0;
3615
3616err:
3617 kfree_skb(skb);
3618 return -EINVAL;
3617} 3619}
3618#else 3620#else
3619static int pfkey_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type, 3621static int pfkey_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type,