archive mirror
 help / color / mirror / Atom feed
From: Anant Thazhemadam <>
Cc: Anant Thazhemadam <>,,,
	Jakub Kicinski <>,,
	"David S. Miller" <>,
Subject: [Linux-kernel-mentees] [PATCH v2] net: fix uninit value error in __sys_sendmmsg
Date: Sun, 13 Sep 2020 16:33:13 +0530	[thread overview]
Message-ID: <> (raw)

The crash report indicated that there was a local variable;
----iovstack.i@__sys_sendmmsg created at:
 ___sys_sendmsg net/socket.c:2388 [inline]
 __sys_sendmmsg+0x6db/0xc90 net/socket.c:2480

 that was left uninitialized.

Initializing this stack to 0s prevents this bug from happening.
Since the memory pointed to by *iov is freed at the end of the function
call, memory leaks are not likely to be an issue.

syzbot seems to have triggered this error by passing an array of 0's as
a parameter while making the system call.

Signed-off-by: Anant Thazhemadam <>
Changes from v1:
	* Fixed the build warning that v1 had introduced
 net/socket.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/socket.c b/net/socket.c
index 0c0144604f81..1e6f9b54982c 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2398,6 +2398,7 @@ static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg,
 	struct iovec iovstack[UIO_FASTIOV], *iov = iovstack;
 	ssize_t err;
+	memset(iov, 0, UIO_FASTIOV);
 	msg_sys->msg_name = &address;
 	err = sendmsg_copy_msghdr(msg_sys, msg, flags, &iov);

Linux-kernel-mentees mailing list

             reply	other threads:[~2020-09-13 11:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-13 11:03 Anant Thazhemadam [this message]
2020-09-13 21:39 ` [Linux-kernel-mentees] [PATCH v2] net: fix uninit value error in __sys_sendmmsg David Miller
2020-09-14  8:14 ` Anant Thazhemadam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).