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]
Date: Fri,  6 Oct 2023 19:41:06 +0800
From: Ma Ke <make_ruc2021@....com>
To: steffen.klassert@...unet.com,
	herbert@...dor.apana.org.au,
	davem@...emloft.net,
	edumazet@...gle.com,
	kuba@...nel.org,
	pabeni@...hat.com
Cc: netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Ma Ke <make_ruc2021@....com>
Subject: [PATCH] net: xfrm: fix return value check in ipcomp_compress

In ipcomp_compress, to avoid an unexpected result returned by
pskb_trim, we should check the return value of pskb_trim().

Signed-off-by: Ma Ke <make_ruc2021@....com>
---
 net/xfrm/xfrm_ipcomp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c
index 9c0fa0e1786a..5f2e6edadf48 100644
--- a/net/xfrm/xfrm_ipcomp.c
+++ b/net/xfrm/xfrm_ipcomp.c
@@ -144,7 +144,9 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb)
 	memcpy(start + sizeof(struct ip_comp_hdr), scratch, dlen);
 	local_bh_enable();
 
-	pskb_trim(skb, dlen + sizeof(struct ip_comp_hdr));
+	err = pskb_trim(skb, dlen + sizeof(struct ip_comp_hdr));
+	if (unlikely(err))
+		goto out;
 	return 0;
 
 out:
-- 
2.37.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ