Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2076305ybp; Thu, 10 Oct 2019 01:45:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqw7T/ol08qlGfCxVje+SxITtW2k4RjFaaXkANrslZc6srB6D8JdAYVSHPt84p2GwNy6ACJc X-Received: by 2002:a05:6402:b16:: with SMTP id bm22mr7083776edb.160.1570697139245; Thu, 10 Oct 2019 01:45:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570697139; cv=none; d=google.com; s=arc-20160816; b=izfn85ViZMZDieNIZm+uT74p+G9DUSBFhmE4oV64/ezlbzhduVjTWJGxUDl3xfX0U4 szJ9vEweK5KbRW2/duNwkNpxOig6ItrAhLoNoAP01dQDVZw0A19SOlWRna8N7ZfuW+Pg cn+Qq2UIdsx3hKmocNsdXaVE4VSD2ZtITSRCywTKYRAiROZdOcq8I7KQplgJltsbtrHJ XqIrAaj4QT0ojyYvYnH7XV464cFc4Hbmr1eGKe4cK8cbnJW0nyjDLocw9IVE+d07ztd1 g0a+N2Vvd5ivlg13wPZ/6SDy5zrm4hN+91QmskL5UOS0pxzcYK5VMS2JBSV/NNw5QwWh P4fQ== 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=kOUZGz7SmdL0XUHhODqEI6rVDeno5FxTnsGAQhZP7XQ=; b=gIWmR+IXGVQQTRDj2FbTTsWDR8Fh9krkfgY/62ft7DoGhkgEI3NNonVW1EKX8Dlr2C KXdu8buUI6UxkFzpcHJ1pj1aDg4Akt5pU8lJmU83WrkZG4y5GLFIXgUedw1/hWUqdaL8 p0mx1pI9a4AXyHIO8lVl9TjPUOwIFkyLPAwhM6iJTO8/ykoHxBZiYVtW9Rm+zWLfEXWA d5TbK36TlNH1nnlZPodBisRTYpO09GOLY/TiFJGVjETC1smaUdnsEILqVbOlLWvjK9hu Cwf8QnDtZoN1HZ86Hy1k1QB6GxZd/HeTIuJnL8RO9uYIs1aHpYmepcVL9u69tpt9fIFS ucjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="tK/ZkLlE"; 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 l15si2800294eja.290.2019.10.10.01.45.16; Thu, 10 Oct 2019 01:45:39 -0700 (PDT) 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="tK/ZkLlE"; 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 S2387700AbfJJIlo (ORCPT + 99 others); Thu, 10 Oct 2019 04:41:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:46126 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388378AbfJJIlj (ORCPT ); Thu, 10 Oct 2019 04:41:39 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 D8C4C2190F; Thu, 10 Oct 2019 08:41:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570696898; bh=K4JtO4D3ApZQ4fgFUps0vrNW1aXpYkqjHX4RDmNYVX8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tK/ZkLlEeuyxm5uqfjCh9wEM8AfEfL/SreZpH185cWL274t9KEo8p+kkNMS2iDcnV Sux3/LqMUHUVZ9zSwhlV2f8TFdNoh9CYEN0WA6urRlBEQ04GPiCuV2S2xzwaG3BDev /IULQWVh6ukeHH485BmX3hcLIP/LL+LXufOqmveY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lu Shuaibing , Dominique Martinet , Sasha Levin Subject: [PATCH 5.3 094/148] 9p: Transport error uninitialized Date: Thu, 10 Oct 2019 10:35:55 +0200 Message-Id: <20191010083616.993439630@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083609.660878383@linuxfoundation.org> References: <20191010083609.660878383@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Lu Shuaibing [ Upstream commit 0ce772fe79b68f83df40f07f28207b292785c677 ] The p9_tag_alloc() does not initialize the transport error t_err field. The struct p9_req_t *req is allocated and stored in a struct p9_client variable. The field t_err is never initialized before p9_conn_cancel() checks its value. KUMSAN(KernelUninitializedMemorySantizer, a new error detection tool) reports this bug. ================================================================== BUG: KUMSAN: use of uninitialized memory in p9_conn_cancel+0x2d9/0x3b0 Read of size 4 at addr ffff88805f9b600c by task kworker/1:2/1216 CPU: 1 PID: 1216 Comm: kworker/1:2 Not tainted 5.2.0-rc4+ #28 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014 Workqueue: events p9_write_work Call Trace: dump_stack+0x75/0xae __kumsan_report+0x17c/0x3e6 kumsan_report+0xe/0x20 p9_conn_cancel+0x2d9/0x3b0 p9_write_work+0x183/0x4a0 process_one_work+0x4d1/0x8c0 worker_thread+0x6e/0x780 kthread+0x1ca/0x1f0 ret_from_fork+0x35/0x40 Allocated by task 1979: save_stack+0x19/0x80 __kumsan_kmalloc.constprop.3+0xbc/0x120 kmem_cache_alloc+0xa7/0x170 p9_client_prepare_req.part.9+0x3b/0x380 p9_client_rpc+0x15e/0x880 p9_client_create+0x3d0/0xac0 v9fs_session_init+0x192/0xc80 v9fs_mount+0x67/0x470 legacy_get_tree+0x70/0xd0 vfs_get_tree+0x4a/0x1c0 do_mount+0xba9/0xf90 ksys_mount+0xa8/0x120 __x64_sys_mount+0x62/0x70 do_syscall_64+0x6d/0x1e0 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 0: (stack is not available) The buggy address belongs to the object at ffff88805f9b6008 which belongs to the cache p9_req_t of size 144 The buggy address is located 4 bytes inside of 144-byte region [ffff88805f9b6008, ffff88805f9b6098) The buggy address belongs to the page: page:ffffea00017e6d80 refcount:1 mapcount:0 mapping:ffff888068b63740 index:0xffff88805f9b7d90 compound_mapcount: 0 flags: 0x100000000010200(slab|head) raw: 0100000000010200 ffff888068b66450 ffff888068b66450 ffff888068b63740 raw: ffff88805f9b7d90 0000000000100001 00000001ffffffff 0000000000000000 page dumped because: kumsan: bad access detected ================================================================== Link: http://lkml.kernel.org/r/20190613070854.10434-1-shuaibinglu@126.com Signed-off-by: Lu Shuaibing [dominique.martinet@cea.fr: grouped the added init with the others] Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin --- net/9p/client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/9p/client.c b/net/9p/client.c index 9622f3e469f67..1d48afc7033ca 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -281,6 +281,7 @@ p9_tag_alloc(struct p9_client *c, int8_t type, unsigned int max_size) p9pdu_reset(&req->tc); p9pdu_reset(&req->rc); + req->t_err = 0; req->status = REQ_STATUS_ALLOC; init_waitqueue_head(&req->wq); INIT_LIST_HEAD(&req->req_list); -- 2.20.1