Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9101314pxu; Mon, 28 Dec 2020 06:40:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8jFpti9zf31D68dq8Sdb3ddQiG7zY55biKxCYhMvZ3kM5WE8vf990dx/uQFyQZKGX8ED3 X-Received: by 2002:a17:907:20a6:: with SMTP id pw6mr42750966ejb.73.1609166417553; Mon, 28 Dec 2020 06:40:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166417; cv=none; d=google.com; s=arc-20160816; b=vtHXSDSD0jWzjZy2QJzB8ImEWum5BMdJ2oiRUy/bDcsNmE7rFSkoL+4JeBS9EATZiT J5U2UJL9CeeQHnzMNM0NXlBIbJwSBmqijeiJftjYmaLeY8l5G9ieMTlza9kYw4Jibi3P LsYWNn6yV6UO/68cf07Oz91tWW7EB1ck7Ltf/eL+03IUBOJF0GlN6qu9Hqrr5snqguDH /p5Tok242WRfD7kUG7YKmMrCZxHrvkVn3qpV3UCNLCpWGkKBeg1he+HbPAp0xUtGfOYT TsK8wfClbInMlEiL2hlFs7mWs2OV04Geh3rDzst2+CD7QAU5GqZTeEkcnFmGTqsPf69X n5Ew== 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=kE3ZkRH0tUEgffRulNX+fGOWp5jmL54Bvq7GqpZFzgM=; b=km561x1W/2vG6iAlVc5Lfm5B8MnSYwHWnX9u7wx28jfDcFr3KDefjirmHHgLUy1bEX RgKnvB1USZCQ3lGNDAIPCP3xW0c+nRJ41S5zrj1xkjbuhbsixLgW5NOAWKBhC6eKwq8E JY8szAuPbLhMWsfcwDH6njr/8jJhIehH3TJVcyr7Ro+Wy7CcTITwL3i3fPI4FHe6ZV+T jf+lJZ3adUWGS9sS9iXHghmWqACvXFAaTXxCt8Lxsk/ndsIxPM3S9LEDvT75qW70fnzX SY/5+1WivVTfVPsZLyT5vmCQQ0kFp+TfJMxY9+k1Zr2XoKMsOGm/bnZraWtZk1Vx9YtS vFfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fDwnOz6O; 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 pk26si17676371ejb.584.2020.12.28.06.39.55; Mon, 28 Dec 2020 06:40:17 -0800 (PST) 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=fDwnOz6O; 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 S2392284AbgL1OiE (ORCPT + 99 others); Mon, 28 Dec 2020 09:38:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:40238 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2504620AbgL1OcL (ORCPT ); Mon, 28 Dec 2020 09:32:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7001422573; Mon, 28 Dec 2020 14:31:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165891; bh=AxoiFViYVZh/CH7Pv/I6I/Qv+57/z6Bfmh3oI2XqIOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fDwnOz6O21VQG1wd22xK9RdOIR/8Yp6Un9uFg2Wh1mMZ4tUdcVEtZuSTmDFe0e5H5 Cmuw4w1KRMZtsP/ojrHGvBarqTb4PnCMlrowbyU1R13iHA9EFQ2qmnL4+NrGEud0p9 eui64JtvQ1YzpdeHLae6JwMk6BTzX8stcTwlbW60= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wang Hai , Dan Williams Subject: [PATCH 5.10 692/717] device-dax/core: Fix memory leak when rmmod dax.ko Date: Mon, 28 Dec 2020 13:51:30 +0100 Message-Id: <20201228125054.130588190@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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: Wang Hai commit 1aa574312518ef1d60d2dc62d58f7021db3b163a upstream. When I repeatedly modprobe and rmmod dax.ko, kmemleak report a memory leak as follows: unreferenced object 0xffff9a5588c05088 (size 8): comm "modprobe", pid 261, jiffies 4294693644 (age 42.063s) ... backtrace: [<00000000e007ced0>] kstrdup+0x35/0x70 [<000000002ae73897>] kstrdup_const+0x3d/0x50 [<000000002b00c9c3>] kvasprintf_const+0xbc/0xf0 [<000000008023282f>] kobject_set_name_vargs+0x3b/0xd0 [<00000000d2cbaa4e>] kobject_set_name+0x62/0x90 [<00000000202e7a22>] bus_register+0x7f/0x2b0 [<000000000b77792c>] 0xffffffffc02840f7 [<000000002d5be5ac>] 0xffffffffc02840b4 [<00000000dcafb7cd>] do_one_initcall+0x58/0x240 [<00000000049fe480>] do_init_module+0x56/0x1e2 [<0000000022671491>] load_module+0x2517/0x2840 [<000000001a2201cb>] __do_sys_finit_module+0x9c/0xe0 [<000000003eb304e7>] do_syscall_64+0x33/0x40 [<0000000051c5fd06>] entry_SYSCALL_64_after_hwframe+0x44/0xa9 When rmmod dax is executed, dax_bus_exit() is missing. This patch can fix this bug. Fixes: 9567da0b408a ("device-dax: Introduce bus + driver model") Cc: Reported-by: Hulk Robot Signed-off-by: Wang Hai Link: https://lore.kernel.org/r/20201201135929.66530-1-wanghai38@huawei.com Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman --- drivers/dax/super.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -752,6 +752,7 @@ err_chrdev: static void __exit dax_core_exit(void) { + dax_bus_exit(); unregister_chrdev_region(dax_devt, MINORMASK+1); ida_destroy(&dax_minor_ida); dax_fs_exit();