Message ID | 20240202210019.88022-2-mathieu.desnoyers@efficios.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D5B2C4828E for <linux-mm@archiver.kernel.org>; Fri, 2 Feb 2024 21:00:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CC3CE6B007D; Fri, 2 Feb 2024 16:00:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C72C76B0082; Fri, 2 Feb 2024 16:00:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B148B6B0085; Fri, 2 Feb 2024 16:00:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9BFC36B007D for <linux-mm@kvack.org>; Fri, 2 Feb 2024 16:00:30 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 034F040FDA for <linux-mm@kvack.org>; Fri, 2 Feb 2024 21:00:29 +0000 (UTC) X-FDA: 81748082220.30.1996167 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf26.hostedemail.com (Postfix) with ESMTP id 3440D140002 for <linux-mm@kvack.org>; Fri, 2 Feb 2024 21:00:28 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=olkQ8vHB; spf=pass (imf26.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com; dmarc=pass (policy=none) header.from=efficios.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706907628; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=TzzyzryuMk/YFmmwdL7/ClcZNi7RCUPErKB9A3hzeXw=; b=Eln+sTZ3lWbYe1cY6QxgJrSUFlcl1HkdvOLHTqfDYm4lKWuWbLG/vYAMHw9GwsRSpML1ol gmiLQxgICd02nCGZBEqmpGBpM0J8/ms4C9qgRy8EcO69Rc9c60X21pq5aAFOhOj1yHNiT7 q+vmJoZXb6j8jAPyxL8cpWrfsmdhV+I= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706907628; a=rsa-sha256; cv=none; b=Te08PnrKnz69AxQuWvAR3jwWJBVEICEjaVGaTTmuxicx+oE+sb5TxpytvUKbDxBg+hsuuz IzvZPLMvDQg5yYvdZOFfgXwTnEBSCLEPNRc56XI3qVUPiJX9sPLPYjepllqMEHxYbJP3Iy lW9VZu/297ui/LcP88HhVsOZx+SsgZY= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=olkQ8vHB; spf=pass (imf26.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com; dmarc=pass (policy=none) header.from=efficios.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706907627; bh=C9trdHKUBo0wvYK5DBzsNfOU9QCkPyPGO5T7CJRyOKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=olkQ8vHBDWpgDSm0PdwKANERNaZOsyNCOuQxCFFGVBsLD7Ag/CgydWr3+PnCboGWb +hIPSsfeUgy6KlyuCCuiuPfERsK/mtMVZeN3F6hj24iXvLlqHKvWVMnhN+ewVfA/AA 9dSCFnRtTxiVUJqwb3fx9CGtZtzDHf3fYXJLNUajd1vzr7dv1k2M3iWpfI25zwFG2Y 1sm0tOKrJZdLKX/2FhGszkqnQD/SyOyzGMpy77l8cbhKZDwxeWGl8+MLyS8GNQ1C4F KSQLZfAtqgBbSQzv5qJelyGnvDGQfHgCKVKnpkAWAutmUaRMOzjk4YKBMbe1yJBvkG KJbJ7UojvG1Ww== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TRSpg0YQmzWvD; Fri, 2 Feb 2024 16:00:27 -0500 (EST) From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> To: Dan Williams <dan.j.williams@intel.com>, Arnd Bergmann <arnd@arndb.de>, Dave Chinner <david@fromorbit.com> Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>, Andrew Morton <akpm@linux-foundation.org>, Linus Torvalds <torvalds@linux-foundation.org>, Vishal Verma <vishal.l.verma@intel.com>, Dave Jiang <dave.jiang@intel.com>, Matthew Wilcox <willy@infradead.org>, Russell King <linux@armlinux.org.uk>, linux-arch@vger.kernel.org, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, dm-devel@lists.linux.dev, nvdimm@lists.linux.dev, linux-s390@vger.kernel.org, Alasdair Kergon <agk@redhat.com>, Mike Snitzer <snitzer@kernel.org>, Mikulas Patocka <mpatocka@redhat.com> Subject: [RFC PATCH v4 01/12] nvdimm/pmem: Fix leak on dax_add_host() failure Date: Fri, 2 Feb 2024 16:00:08 -0500 Message-Id: <20240202210019.88022-2-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240202210019.88022-1-mathieu.desnoyers@efficios.com> References: <20240202210019.88022-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Stat-Signature: sg81fgt8agbx9jquyeh1ob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YStv9wdDj3DmGOZfPBYKh2mV87bSC+uSwy/f5kmWijhrt4pzUP6jbgCGRK7gxWolJwogJAOFfvSTcpi1M6ba6RJ3tT6GULdemHqEIanUspJbIK6kpPXtVEm2UTQuWaXn2wEbDDJR9gMCZi8LiARmpq8n63NCrwD4iUvKzE/KgxlTnp0Rou1ITfIIy2Em9cpnOYdH8fjqaF0UmChfHimIYJgMUIknlPJnDx/y1VECJASmli3HgZQNRz0k9wWqDwTbDCHTOG6871X5PbBEir8YVzcAWt0FRqPmPt9o6Xap/0GvIslHKUIz2toMP6dolBT06eKbpokQJ5feIgIu/hP/dePElf9bl9ErW+0YEiVGMNRjEvc7FrbiPmaj3FJ/MLzU5nwyxnYAnfPUu2NhEFKtfjPhwyRggybdO1vZsVk5EU1nTm7wEgHOxP+jixfNLj47xzl4+OUt+wZFDsutQJ/GiqaCDzW6g1T9y4VyOHJaz09/7AwCflk/N3Ded5oKULn2iXNdtnQp0jSuftToXmNvtndpgFzlSYNGQn7P8paDD+s48Gn0n1aPch8r0HmD3xL6p+ApIx/4WveSe4tkXCMiiBhR1oaCiO8MzbZDZ4SwVErGuPfurkOfBUVdRUM/OplVyr0vIkmaw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Introduce cpu_dcache_is_aliasing() to fix DAX regression
|
expand
|
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 4e8fdcb3f1c8..9fe358090720 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -566,12 +566,11 @@ static int pmem_attach_disk(struct device *dev, set_dax_nomc(dax_dev); if (is_nvdimm_sync(nd_region)) set_dax_synchronous(dax_dev); + pmem->dax_dev = dax_dev; rc = dax_add_host(dax_dev, disk); if (rc) goto out_cleanup_dax; dax_write_cache(dax_dev, nvdimm_has_cache(nd_region)); - pmem->dax_dev = dax_dev; - rc = device_add_disk(dev, disk, pmem_attribute_groups); if (rc) goto out_remove_host;
Fix a leak on dax_add_host() error, where "goto out_cleanup_dax" is done before setting pmem->dax_dev, which therefore issues the two following calls on NULL pointers: out_cleanup_dax: kill_dax(pmem->dax_dev); put_dax(pmem->dax_dev); Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Alasdair Kergon <agk@redhat.com> Cc: Mike Snitzer <snitzer@kernel.org> Cc: Mikulas Patocka <mpatocka@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Vishal Verma <vishal.l.verma@intel.com> Cc: Dave Jiang <dave.jiang@intel.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Russell King <linux@armlinux.org.uk> Cc: linux-arch@vger.kernel.org Cc: linux-cxl@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org Cc: linux-mm@kvack.org Cc: linux-xfs@vger.kernel.org Cc: dm-devel@lists.linux.dev Cc: nvdimm@lists.linux.dev --- drivers/nvdimm/pmem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)