summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2017-03-08 20:08:16 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-20 12:07:18 +0300
commitae0ebdba96674c278674d2b12eedde0681e42f91 (patch)
tree1c2e662cf8e4e56a52ab68d16b1823f0fac5aa86 /net
parent6783015096dc66dee0035baeec410f16b6ee2d84 (diff)
downloadlinux-ae0ebdba96674c278674d2b12eedde0681e42f91.tar.xz
net: initialize msg.msg_flags in recvfrom
[ Upstream commit 9f138fa609c47403374a862a08a41394be53d461 ] KMSAN reports a use of uninitialized memory in put_cmsg() because msg.msg_flags in recvfrom haven't been initialized properly. The flag values don't affect the result on this path, but it's still a good idea to initialize them explicitly. Signed-off-by: Alexander Potapenko <glider@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/socket.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c
index 6bbccf05854f..05f13b24572c 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1702,6 +1702,7 @@ SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size,
/* We assume all kernel code knows the size of sockaddr_storage */
msg.msg_namelen = 0;
msg.msg_iocb = NULL;
+ msg.msg_flags = 0;
if (sock->file->f_flags & O_NONBLOCK)
flags |= MSG_DONTWAIT;
err = sock_recvmsg(sock, &msg, flags);