Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp432533pxj; Thu, 20 May 2021 12:45:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKO6HXGcxEzntQUsydxdcRyaOICleKl4DzUjue+UXhpDnaSv2OjGLZvF2Db8UWPOAirOYF X-Received: by 2002:a17:906:8504:: with SMTP id i4mr6420633ejx.515.1621539924504; Thu, 20 May 2021 12:45:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621539924; cv=none; d=google.com; s=arc-20160816; b=ij+ujrDC0KF1zcg9khHRe5eCOG5xkjFcmh1uXEyZFSKYeKi0cPq/rnwI1lzeSTsTO6 wVsjbnQV64WDXHw82VxtZ+uQTQXIx7hTB6gbDRZX4nC6/+cqmPaQJGERfqlB+l6QEVUz iXcQmJUJoEvR6YaOlHzpUpXo8Qp1r6Th/iPTSHx7VkssYXziUwXOXM1M0V2fwCtXFBAL KSFmpuDlOznj6+VlPQzK9f+3D4UbSVNuE8wwrZQg0/dUGJtHzpO9ytd/5/Uy4Ax8cBTX XhWDB83q2y0zRVzDxzP0b0VD/QDfgYNr0k4aZWMahzWXOzEZYj2jCeL49p4id1mFBmmV m8IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qXmvX1devogn4a+t6DVp+146R82aoVhznTmeFkRKnF0=; b=fRYWXBadt0UbDhvXwOOy1XKOyvsBm2u0bzVcitGhbRIq7fgiGH1wxDSeijY242fVod CDdyC+t4tbi5v9bkovbDQ6deyWV7rHzcrt1Ezy0hE4Wit1h3Fc31RmxWyaUgyCb1+MXn GNaw0e3YYoGH2LDshZ/2231ckuldYKHpJYNcumyMjk83Am6E8zGewY54wFZtwzXIRZIy XjAbPYBu/xcbYo2VoXY+BbvL7wmUd0oUi8PHjMVylVDrVFtHAcAHOJAK25UjF6s84ODx PmFJnupR2iU2a/2I/pfXeX7/J6eVjSEhBp/eOI6VEQdVUgCX/tMX4QkBIgGmhrfMPI6d tnlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AXU4Cagi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jz8si927160ejc.34.2021.05.20.12.44.50; Thu, 20 May 2021 12:45:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AXU4Cagi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238109AbhETKj1 (ORCPT + 99 others); Thu, 20 May 2021 06:39:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:55738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236745AbhETKY1 (ORCPT ); Thu, 20 May 2021 06:24:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D7B696101E; Thu, 20 May 2021 09:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504160; bh=xix8bAIQHk01R+mSm4qOXOstWPRJzFpE70gb+hsBdXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AXU4CagiEbQJ5AaHBViAQWww6FG9L4OzVqYra9PYH6gbWjBSQv6RoLbkUIiz5BwI6 qqXsYrDtxHgm3bIFl0kZyIR257cal+OX/0iYVe3wjrhLh/KztJVIjxiJeQWoDhejZJ yadqjEya4oT2N0x7r/jnvPk9bv8pIYRZw3EmL3oM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tetsuo Handa Subject: [PATCH 4.14 119/323] misc: vmw_vmci: explicitly initialize vmci_datagram payload Date: Thu, 20 May 2021 11:20:11 +0200 Message-Id: <20210520092124.188702969@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tetsuo Handa commit b2192cfeba8481224da0a4ec3b4a7ccd80b1623b upstream. KMSAN complains that vmci_check_host_caps() left the payload part of check_msg uninitialized. ===================================================== BUG: KMSAN: uninit-value in kmsan_check_memory+0xd/0x10 CPU: 1 PID: 1 Comm: swapper/0 Tainted: G B 5.11.0-rc7+ #4 Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 02/27/2020 Call Trace: dump_stack+0x21c/0x280 kmsan_report+0xfb/0x1e0 kmsan_internal_check_memory+0x202/0x520 kmsan_check_memory+0xd/0x10 iowrite8_rep+0x86/0x380 vmci_guest_probe_device+0xf0b/0x1e70 pci_device_probe+0xab3/0xe70 really_probe+0xd16/0x24d0 driver_probe_device+0x29d/0x3a0 device_driver_attach+0x25a/0x490 __driver_attach+0x78c/0x840 bus_for_each_dev+0x210/0x340 driver_attach+0x89/0xb0 bus_add_driver+0x677/0xc40 driver_register+0x485/0x8e0 __pci_register_driver+0x1ff/0x350 vmci_guest_init+0x3e/0x41 vmci_drv_init+0x1d6/0x43f do_one_initcall+0x39c/0x9a0 do_initcall_level+0x1d7/0x259 do_initcalls+0x127/0x1cb do_basic_setup+0x33/0x36 kernel_init_freeable+0x29a/0x3ed kernel_init+0x1f/0x840 ret_from_fork+0x1f/0x30 Uninit was created at: kmsan_internal_poison_shadow+0x5c/0xf0 kmsan_slab_alloc+0x8d/0xe0 kmem_cache_alloc+0x84f/0xe30 vmci_guest_probe_device+0xd11/0x1e70 pci_device_probe+0xab3/0xe70 really_probe+0xd16/0x24d0 driver_probe_device+0x29d/0x3a0 device_driver_attach+0x25a/0x490 __driver_attach+0x78c/0x840 bus_for_each_dev+0x210/0x340 driver_attach+0x89/0xb0 bus_add_driver+0x677/0xc40 driver_register+0x485/0x8e0 __pci_register_driver+0x1ff/0x350 vmci_guest_init+0x3e/0x41 vmci_drv_init+0x1d6/0x43f do_one_initcall+0x39c/0x9a0 do_initcall_level+0x1d7/0x259 do_initcalls+0x127/0x1cb do_basic_setup+0x33/0x36 kernel_init_freeable+0x29a/0x3ed kernel_init+0x1f/0x840 ret_from_fork+0x1f/0x30 Bytes 28-31 of 36 are uninitialized Memory access of size 36 starts at ffff8881675e5f00 ===================================================== Fixes: 1f166439917b69d3 ("VMCI: guest side driver implementation.") Cc: Signed-off-by: Tetsuo Handa Link: https://lore.kernel.org/r/20210402121742.3917-2-penguin-kernel@I-love.SAKURA.ne.jp Signed-off-by: Greg Kroah-Hartman --- drivers/misc/vmw_vmci/vmci_guest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/misc/vmw_vmci/vmci_guest.c +++ b/drivers/misc/vmw_vmci/vmci_guest.c @@ -169,7 +169,7 @@ static int vmci_check_host_caps(struct p VMCI_UTIL_NUM_RESOURCES * sizeof(u32); struct vmci_datagram *check_msg; - check_msg = kmalloc(msg_size, GFP_KERNEL); + check_msg = kzalloc(msg_size, GFP_KERNEL); if (!check_msg) { dev_err(&pdev->dev, "%s: Insufficient memory\n", __func__); return -ENOMEM;