lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1560500786-572-1-git-send-email-92siuyang@gmail.com>
Date:   Fri, 14 Jun 2019 16:26:26 +0800
From:   Young Xiao <92siuyang@...il.com>
To:     steffen.klassert@...unet.com, herbert@...dor.apana.org.au,
        davem@...emloft.net, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     Young Xiao <92siuyang@...il.com>
Subject: [PATCH] af_key: Fix memory leak in key_notify_policy.

We leak the allocated out_skb in case pfkey_xfrm_policy2msg() fails.
Fix this by freeing it on error.

Signed-off-by: Young Xiao <92siuyang@...il.com>
---
 net/key/af_key.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/key/af_key.c b/net/key/af_key.c
index 4af1e1d..ec414f6 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -2443,6 +2443,7 @@ static int key_pol_get_resp(struct sock *sk, struct xfrm_policy *xp, const struc
 	}
 	err = pfkey_xfrm_policy2msg(out_skb, xp, dir);
 	if (err < 0)
+		kfree_skb(out_skb);
 		goto out;
 
 	out_hdr = (struct sadb_msg *) out_skb->data;
@@ -2695,6 +2696,7 @@ static int dump_sp(struct xfrm_policy *xp, int dir, int count, void *ptr)
 
 	err = pfkey_xfrm_policy2msg(out_skb, xp, dir);
 	if (err < 0)
+		kfree_skb(out_skb);
 		return err;
 
 	out_hdr = (struct sadb_msg *) out_skb->data;
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ