Re: [syzbot] [bpf?] [net?] WARNING in __sk_msg_free
From: Edward Adam Davis
Date: Tue Jan 09 2024 - 00:41:04 EST
please test WARNING in __sk_msg_free
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index e37b4d2e2acd..68dbe821f61d 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -1016,6 +1016,8 @@ static int tls_sw_sendmsg_locked(struct sock *sk, struct msghdr *msg,
msg_pl = &rec->msg_plaintext;
msg_en = &rec->msg_encrypted;
+ if (msg_pl->sg.end >= MAX_MSG_FRAGS)
+ return -EINVAL;
orig_size = msg_pl->sg.size;
full_record = false;