Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6254850imu; Mon, 21 Jan 2019 05:56:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN6kZXiZ0Wm4YxVS7k26j158IqiJzbqquPf3f7hJLvAaeZ6E4Y4MDCmxJGhxx4hPfb2Q/fzA X-Received: by 2002:a63:580a:: with SMTP id m10mr27809511pgb.332.1548078979636; Mon, 21 Jan 2019 05:56:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548078979; cv=none; d=google.com; s=arc-20160816; b=AhK/CTZRodZtVX2RQHFAAcMnDUsd3z8B3QQaNv2odS7TbY25FiJg2f7Zs6DpUlIJuF 2BulL/+iXoQgecRJsYVhEY8Uq1Sg1QvZsmjhor/JR7EndYCX8BRqI9YbI1ZqLAF3VtB0 9JjoK7sxxA8TbJi/DQkPGCjNXDk66FUEQnIcWxAfliyDPzza+n/CBvhROLEc7BE4Ylhb B64DAxQ4YFgI2w/6r1EGyUQAQKDwWd7FNN5AaaOC6QgJ5UKS3RbbQKWTnrtCTAomxYJQ 9Vc19aLbj6ApaNahUWAVwmE4jzPNGa+hEu1CZRLCV4XtiWFt/4YeqYnfhJiS09GBh3d8 Us6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5ejxb1ytjGiiIHfXTmkF3NTQQlwz1WndfbIv8SH0o6c=; b=WGkoIPcEah2MMhBPe2VTBe9zhvHHgfp1533Oqvbb9vekivhmEqQBhzqmhoHyrU47Ib co4qahi8Nl7hYw0lRu1P96yla/7zr5XuOkCQ05wYmU/kCaixg1gD26dG4vqEkqL2RXHp pIgD6CIyScGNDWfJksGyRdK0QrYIhyBB0mlVxkZ5QPbBBYpu/y1OPiPuMGjs5v049zOl Vr2BWWoUIgDWpQTLpIjoKrIs02f4ITZ94e5nfZu3hxnw6ivHTpmbl46WAXdAEBPoIls9 5xxUcqIqxyo4IuuuSR3GkzJyL/bOaRLHdaPxlqvUDPrbgtxEyTkdId7AciUw3tV3lfXo j9ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DrG+eYOk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p11si11824669plo.363.2019.01.21.05.56.04; Mon, 21 Jan 2019 05:56:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DrG+eYOk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731299AbfAUNxf (ORCPT + 99 others); Mon, 21 Jan 2019 08:53:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:37334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730609AbfAUNxc (ORCPT ); Mon, 21 Jan 2019 08:53:32 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 62C372084C; Mon, 21 Jan 2019 13:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548078810; bh=aNjI3KDuL4sEZAqWHOZXEbWW7lSz+xPD3oScKNAsFng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DrG+eYOkmWlmDotrZ2hpPwE/DdcZ6Wx6Xdgsje3K3ZPK6uehC4dIMWDHWxVSeN83A 6CLD41PT90j+BQA23Tm3tO03KMK8DQ2k0uBjSW1bNges2MIK1mVOaMyNu0HMqBeiu7 SceZfHpb8dVrtqQnxpFMb/kb9vOQtTnoWENRPo2c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+06e771a754829716a327@syzkaller.appspotmail.com, Ying Xue , "David S. Miller" Subject: [PATCH 4.14 51/59] tipc: fix uninit-value in tipc_nl_compat_name_table_dump Date: Mon, 21 Jan 2019 14:44:16 +0100 Message-Id: <20190121122502.390059178@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121122456.529172919@linuxfoundation.org> References: <20190121122456.529172919@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ying Xue commit 974cb0e3e7c963ced06c4e32c5b2884173fa5e01 upstream. syzbot reported: BUG: KMSAN: uninit-value in __arch_swab32 arch/x86/include/uapi/asm/swab.h:10 [inline] BUG: KMSAN: uninit-value in __fswab32 include/uapi/linux/swab.h:59 [inline] BUG: KMSAN: uninit-value in tipc_nl_compat_name_table_dump+0x4a8/0xba0 net/tipc/netlink_compat.c:826 CPU: 0 PID: 6290 Comm: syz-executor848 Not tainted 4.19.0-rc8+ #70 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x306/0x460 lib/dump_stack.c:113 kmsan_report+0x1a2/0x2e0 mm/kmsan/kmsan.c:917 __msan_warning+0x7c/0xe0 mm/kmsan/kmsan_instr.c:500 __arch_swab32 arch/x86/include/uapi/asm/swab.h:10 [inline] __fswab32 include/uapi/linux/swab.h:59 [inline] tipc_nl_compat_name_table_dump+0x4a8/0xba0 net/tipc/netlink_compat.c:826 __tipc_nl_compat_dumpit+0x59e/0xdb0 net/tipc/netlink_compat.c:205 tipc_nl_compat_dumpit+0x63a/0x820 net/tipc/netlink_compat.c:270 tipc_nl_compat_handle net/tipc/netlink_compat.c:1151 [inline] tipc_nl_compat_recv+0x1402/0x2760 net/tipc/netlink_compat.c:1210 genl_family_rcv_msg net/netlink/genetlink.c:601 [inline] genl_rcv_msg+0x185c/0x1a20 net/netlink/genetlink.c:626 netlink_rcv_skb+0x394/0x640 net/netlink/af_netlink.c:2454 genl_rcv+0x63/0x80 net/netlink/genetlink.c:637 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline] netlink_unicast+0x166d/0x1720 net/netlink/af_netlink.c:1343 netlink_sendmsg+0x1391/0x1420 net/netlink/af_netlink.c:1908 sock_sendmsg_nosec net/socket.c:621 [inline] sock_sendmsg net/socket.c:631 [inline] ___sys_sendmsg+0xe47/0x1200 net/socket.c:2116 __sys_sendmsg net/socket.c:2154 [inline] __do_sys_sendmsg net/socket.c:2163 [inline] __se_sys_sendmsg+0x307/0x460 net/socket.c:2161 __x64_sys_sendmsg+0x4a/0x70 net/socket.c:2161 do_syscall_64+0xbe/0x100 arch/x86/entry/common.c:291 entry_SYSCALL_64_after_hwframe+0x63/0xe7 RIP: 0033:0x440179 Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007ffecec49318 EFLAGS: 00000213 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 0000000000440179 RDX: 0000000000000000 RSI: 0000000020000100 RDI: 0000000000000003 RBP: 00000000006ca018 R08: 0000000000000000 R09: 00000000004002c8 R10: 0000000000000000 R11: 0000000000000213 R12: 0000000000401a00 R13: 0000000000401a90 R14: 0000000000000000 R15: 0000000000000000 Uninit was created at: kmsan_save_stack_with_flags mm/kmsan/kmsan.c:255 [inline] kmsan_internal_poison_shadow+0xc8/0x1d0 mm/kmsan/kmsan.c:180 kmsan_kmalloc+0xa4/0x120 mm/kmsan/kmsan_hooks.c:104 kmsan_slab_alloc+0x10/0x20 mm/kmsan/kmsan_hooks.c:113 slab_post_alloc_hook mm/slab.h:446 [inline] slab_alloc_node mm/slub.c:2727 [inline] __kmalloc_node_track_caller+0xb43/0x1400 mm/slub.c:4360 __kmalloc_reserve net/core/skbuff.c:138 [inline] __alloc_skb+0x422/0xe90 net/core/skbuff.c:206 alloc_skb include/linux/skbuff.h:996 [inline] netlink_alloc_large_skb net/netlink/af_netlink.c:1189 [inline] netlink_sendmsg+0xcaf/0x1420 net/netlink/af_netlink.c:1883 sock_sendmsg_nosec net/socket.c:621 [inline] sock_sendmsg net/socket.c:631 [inline] ___sys_sendmsg+0xe47/0x1200 net/socket.c:2116 __sys_sendmsg net/socket.c:2154 [inline] __do_sys_sendmsg net/socket.c:2163 [inline] __se_sys_sendmsg+0x307/0x460 net/socket.c:2161 __x64_sys_sendmsg+0x4a/0x70 net/socket.c:2161 do_syscall_64+0xbe/0x100 arch/x86/entry/common.c:291 entry_SYSCALL_64_after_hwframe+0x63/0xe7 We cannot take for granted the thing that the length of data contained in TLV is longer than the size of struct tipc_name_table_query in tipc_nl_compat_name_table_dump(). Reported-by: syzbot+06e771a754829716a327@syzkaller.appspotmail.com Signed-off-by: Ying Xue Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/tipc/netlink_compat.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/tipc/netlink_compat.c +++ b/net/tipc/netlink_compat.c @@ -815,6 +815,8 @@ static int tipc_nl_compat_name_table_dum }; ntq = (struct tipc_name_table_query *)TLV_DATA(msg->req); + if (TLV_GET_DATA_LEN(msg->req) < sizeof(struct tipc_name_table_query)) + return -EINVAL; depth = ntohl(ntq->depth);