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: <20250715081158.7651-1-pranav.tyagi03@gmail.com>
Date: Tue, 15 Jul 2025 13:41:58 +0530
From: Pranav Tyagi <pranav.tyagi03@...il.com>
To: john.fastabend@...il.com,
	jakub@...udflare.com,
	davem@...emloft.net,
	edumazet@...gle.com,
	kuba@...nel.org,
	pabeni@...hat.com,
	ast@...nel.org,
	cong.wang@...edance.com,
	netdev@...r.kernel.org,
	bpf@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: skhan@...uxfoundation.org,
	linux-kernel-mentees@...ts.linux.dev,
	Pranav Tyagi <pranav.tyagi03@...il.com>,
	syzbot+b18872ea9631b5dcef3b@...kaller.appspotmail.com
Subject: [PATCH] net: skmsg: fix NULL pointer dereference in sk_msg_recvmsg()

A NULL page from sg_page() in sk_msg_recvmsg() can reach
__kmap_local_page_prot() and crash the kernel. Add a check for the page
before calling copy_page_to_iter() and fail early with -EFAULT to
prevent the crash.

Reported-by: syzbot+b18872ea9631b5dcef3b@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=b18872ea9631b5dcef3b
Fixes: 2bc793e3272a ("skmsg: Extract __tcp_bpf_recvmsg() and tcp_bpf_wait_data()")
Signed-off-by: Pranav Tyagi <pranav.tyagi03@...il.com>
---
 net/core/skmsg.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index 4d75ef9d24bf..f5367356a483 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -432,6 +432,10 @@ int sk_msg_recvmsg(struct sock *sk, struct sk_psock *psock, struct msghdr *msg,
 			sge = sk_msg_elem(msg_rx, i);
 			copy = sge->length;
 			page = sg_page(sge);
+			if (!page) {
+				copied = copied ? copied : -EFAULT;
+				goto out;
+			}
 			if (copied + copy > len)
 				copy = len - copied;
 			copy = copy_page_to_iter(page, sge->offset, copy, iter);
-- 
2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ