]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
netlink: fix uninit-value in netlink_sendmsg
authorEric Dumazet <edumazet@google.com>
Sat, 7 Apr 2018 20:42:37 +0000 (13:42 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 14 Aug 2018 10:25:39 +0000 (12:25 +0200)
BugLink: http://bugs.launchpad.net/bugs/1780499
commit 6091f09c2f79730d895149bcfe3d66140288cd0e upstream.

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 <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/netlink/af_netlink.c

index 1245aa1d6e1c90af665c792dacc3fc3839361127..25d2c19ed01c73bf8b1be1f19de2efe6e2df0846 100644 (file)
@@ -1812,6 +1812,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;