Return-Path: Received: from mail-sn1nam01on0099.outbound.protection.outlook.com ([104.47.32.99]:2346 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754806AbeARVFf (ORCPT ); Thu, 18 Jan 2018 16:05:35 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Alexander Potapenko , "David S . Miller" , Sasha Levin Subject: [added to the 4.1 stable tree] net: initialize msg.msg_flags in recvfrom Date: Thu, 18 Jan 2018 21:01:23 +0000 Message-ID: <20180118205908.3220-224-alexander.levin@microsoft.com> References: <20180118205908.3220-1-alexander.levin@microsoft.com> In-Reply-To: <20180118205908.3220-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Alexander Potapenko This patch has been added to the stable tree. If you have any objections, please let us know. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/socket.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/socket.c b/net/socket.c index 8327df0448f4..12d681c1b66d 100644 --- a/net/socket.c +++ b/net/socket.c @@ -1706,6 +1706,7 @@ SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubu= f, size_t, size, /* We assume all kernel code knows the size of sockaddr_storage */ msg.msg_namelen =3D 0; msg.msg_iocb =3D NULL; + msg.msg_flags =3D 0; if (sock->file->f_flags & O_NONBLOCK) flags |=3D MSG_DONTWAIT; err =3D sock_recvmsg(sock, &msg, iov_iter_count(&msg.msg_iter), flags); --=20 2.11.0