From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: [PATCH net 2/8] netlink: fix uninit-value in netlink_sendmsg Date: Sat, 7 Apr 2018 13:42:37 -0700 Message-ID: <20180407204243.176626-3-edumazet@google.com> References: <20180407204243.176626-1-edumazet@google.com> Cc: netdev , Eric Dumazet , Eric Dumazet To: "David S . Miller" Return-path: Received: from mail-pl0-f67.google.com ([209.85.160.67]:35114 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752878AbeDGUn3 (ORCPT ); Sat, 7 Apr 2018 16:43:29 -0400 Received: by mail-pl0-f67.google.com with SMTP id 61-v6so2720307plb.2 for ; Sat, 07 Apr 2018 13:43:29 -0700 (PDT) In-Reply-To: <20180407204243.176626-1-edumazet@google.com> Sender: netdev-owner@vger.kernel.org List-ID: syzbot reported : BUG: KMSAN: uninit-value in ffs arch/x86/include/asm/bitops.h:432 [inline] BUG: KMSAN: uninit-value in netlink_sendmsg+0xb26/0x1310 net/netlink/af_netlink.c:1851 Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Eric Dumazet Reported-by: syzbot --- net/netlink/af_netlink.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index fa556fdef57d8a684bd73de05821514482db2eea..55342c4d5cec6a999065aa1c9607bdf476c59d36 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -1844,6 +1844,8 @@ static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) if (msg->msg_namelen) { err = -EINVAL; + if (msg->msg_namelen < sizeof(struct sockaddr_nl)) + goto out; if (addr->nl_family != AF_NETLINK) goto out; dst_portid = addr->nl_pid; -- 2.17.0.484.g0c8726318c-goog