Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2366222imu; Thu, 24 Jan 2019 11:29:21 -0800 (PST) X-Google-Smtp-Source: ALg8bN4ngvjasuQHWYvBXbxV5pGo1fw2NZhScg3z7+ll68NAM4YaR/pib1AShSpMK8JaQqlEubpQ X-Received: by 2002:a63:165e:: with SMTP id 30mr7121352pgw.103.1548358161388; Thu, 24 Jan 2019 11:29:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548358161; cv=none; d=google.com; s=arc-20160816; b=wvPLVsM/qCSZfgYoh1vZ/GdYceWmCtS9Tp6ZLyNTGlG/Oeh4SIMaThJG+dS8DsSCzd LBtbK6Me9INtf2t5EcHH+Ax17mv/q1PKBvto3rcxwciWnzxuCaT1X71CYQ29TApV9rYe CZZxZrMkYV0h3tcq8PLtnwQsKr6rk59fyLNzUiPxgZsMCJN1VwynrjWMY9f4zgXm+zrh ScjK/d3I3fTZfRSWjOZksfLB+V4t/D2/TS5rcDa3zCw1crYrazZtHQZ6n1NfL0GybP4W ENCHkcY57xQxlx24eBfSLOkTuQdkjApE2rCN3MOmhhAf+KHwiYFdF9Srj12Ol9jVFPa5 cJOw== 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=JsnTh2UhrYzE+pXwU9NRvxUEsVOgR5I7sQGIVfFc284=; b=pqC5OWScjeaTdKI1ToOrkmiI32yD6HyW6L8xkR1heWxVaK/hxFq00xVMjZCkk9E2/k WJ3zHh9Ce8it+EE7CqXmqA1SbsIC78GiNpGy5IEM4lDPGZLncIytf3kalDe52pPrgs1O v1nCfJoZxDZ2qxMzgx1/u9d1oxCHYPM1/SusrbTfUf24GVNP9zgEI5PNoLym9BS39YI7 4bGj2WhqL2jzepIFamvX6P4/tt34M6V6GjIhtUpE4LJen9GpLh+HpV3w4rnQb88OGaW1 NjgAws9h/b7SvSzhXxzIiHYhrftuPke/SBJ5goO2SqiZrNJdltPoiJR5MW6gqXUiUGSO oh2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="bQcb/76M"; 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 q24si22895029pls.325.2019.01.24.11.29.05; Thu, 24 Jan 2019 11:29:21 -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="bQcb/76M"; 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 S1730196AbfAXT0w (ORCPT + 99 others); Thu, 24 Jan 2019 14:26:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:52906 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730626AbfAXT0t (ORCPT ); Thu, 24 Jan 2019 14:26:49 -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 6D4A2218FC; Thu, 24 Jan 2019 19:26:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548358007; bh=9rDsIYY0S6cANqyiqqpsQYZjfuQgDjNIfUbMq/xngy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bQcb/76MFvWpd2LfuQKP2tW+3AOcZpYa5Irx7Hae81w/ZyBMq8PK9lGJw9MAXVqlb +cyxXzNkCSKzhUXqAC3bmx8xeyNRjjW7wSH5+XwAGckxoo5XuR8Ml3g+C/WRlHsXT/ whxLQQ2iEa8PwcplzSD+nCzVJj4axXGkkevaLobk= 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.4 065/104] tipc: fix uninit-value in tipc_nl_compat_name_table_dump Date: Thu, 24 Jan 2019 20:19:54 +0100 Message-Id: <20190124190202.800331839@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190124190154.968308875@linuxfoundation.org> References: <20190124190154.968308875@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.4-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 @@ -785,6 +785,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);