Message ID | 20190421014429.31206-2-pasha.tatashin@soleen.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show
Return-Path: <linux-nvdimm-bounces@lists.01.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 54D8A1515 for <patchwork-linux-nvdimm@patchwork.kernel.org>; Sun, 21 Apr 2019 01:44:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 468F028960 for <patchwork-linux-nvdimm@patchwork.kernel.org>; Sun, 21 Apr 2019 01:44:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A4522896D; Sun, 21 Apr 2019 01:44:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 97E3828960 for <patchwork-linux-nvdimm@patchwork.kernel.org>; Sun, 21 Apr 2019 01:44:35 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8CCED2121797F; Sat, 20 Apr 2019 18:44:35 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::844; helo=mail-qt1-x844.google.com; envelope-from=pasha.tatashin@soleen.com; receiver=linux-nvdimm@lists.01.org Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E2BA4211F9D74 for <linux-nvdimm@lists.01.org>; Sat, 20 Apr 2019 18:44:34 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id p20so8949092qtc.9 for <linux-nvdimm@lists.01.org>; Sat, 20 Apr 2019 18:44:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=CYN5iyU5BivsuLuaj0p6OjCQw7Id7vPwrKGL/YIcXb0=; b=Lx4n3eeQsd3DKBZFt1X+n0tHyvdxX9eMXlbGkCZXa5jPDl+R+bxvhnePCzuiVFH+jk di+Mp6Mfiv5tBZu3YjQsIuC9JNhQV5AoV/J9rAuT1n2Pzo9ukHrKDSQHkIHF92Mqzxql YvxHUk9CCjLHPwU2JfPC6Jb4K3eYzQaEOCweZDDMP3zNxsjvacM4Si4fbi0xJj8A+ZHM HRrrp8lKjP5UFpftK/lphzl+xQk7hG0nsmdRNOw9TAxyhOTDr3q5eE7aOoZRIevE2SJ1 IyWD1DfUU79PI1VB99cVVKjDHJ6TbNTIQlFTSgKgHQNPdqcPC2df8BsTeVhpEsSjlzIL cz1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CYN5iyU5BivsuLuaj0p6OjCQw7Id7vPwrKGL/YIcXb0=; b=YYKCPC/NgNm+1Gdfcr+24mqB618hj2xktMF4NpN7gd9zvIoIwd2BKzTHu16u5g02o3 mxVTycaygljUroO1naDYrW9YT8rTVo/BdjLMh1/TnWb9kqLyN4ej7MUR/U5HQT4LdbFQ njoGvoYBolrchPhX9xU6QGTO/7Vtwom3PSVqhhS/gxjs5E2LMUiE0xFkakjWtceyj7Fv AbGoVvNTEmEBi466Zvb8D4+BBU7DtnguMZ6WOr2C27H6InURVC9+r0UmOUsZsdHD77UD Qx8EL16csT6h54Qk0+acHXjiJ5KPXJW3lITfp2Ca6Ar73jhA0ikINzNze8ANs415MyL3 iUzA== X-Gm-Message-State: APjAAAW3P3Cx+iQDGCoG7FF8+dyqpOGfi9maVtXrGB9GYKprspT2/7FU OBB9JDh9FjEQFVc7BUTmlxjTnA== X-Google-Smtp-Source: APXvYqyGwfhqvlrszPLC8qN9m2XQDrZ+wKGZWzLF7GM7scRLtBDlMXL92I0fVQaBdczXZtyMg5jLVQ== X-Received: by 2002:ad4:430c:: with SMTP id c12mr10017920qvs.109.1555811074063; Sat, 20 Apr 2019 18:44:34 -0700 (PDT) Received: from localhost.localdomain (c-73-69-118-222.hsd1.nh.comcast.net. [73.69.118.222]) by smtp.gmail.com with ESMTPSA id u1sm1385218qtj.50.2019.04.20.18.44.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 Apr 2019 18:44:33 -0700 (PDT) From: Pavel Tatashin <pasha.tatashin@soleen.com> To: pasha.tatashin@soleen.com, jmorris@namei.org, sashal@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-nvdimm@lists.01.org, akpm@linux-foundation.org, mhocko@suse.com, dave.hansen@linux.intel.com, dan.j.williams@intel.com, keith.busch@intel.com, vishal.l.verma@intel.com, dave.jiang@intel.com, zwisler@kernel.org, thomas.lendacky@amd.com, ying.huang@intel.com, fengguang.wu@intel.com, bp@suse.de, bhelgaas@google.com, baiyaowei@cmss.chinamobile.com, tiwai@suse.de, jglisse@redhat.com Subject: [v2 1/2] device-dax: fix memory and resource leak if hotplug fails Date: Sat, 20 Apr 2019 21:44:28 -0400 Message-Id: <20190421014429.31206-2-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190421014429.31206-1-pasha.tatashin@soleen.com> References: <20190421014429.31206-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." <linux-nvdimm.lists.01.org> List-Unsubscribe: <https://lists.01.org/mailman/options/linux-nvdimm>, <mailto:linux-nvdimm-request@lists.01.org?subject=unsubscribe> List-Archive: <http://lists.01.org/pipermail/linux-nvdimm/> List-Post: <mailto:linux-nvdimm@lists.01.org> List-Help: <mailto:linux-nvdimm-request@lists.01.org?subject=help> List-Subscribe: <https://lists.01.org/mailman/listinfo/linux-nvdimm>, <mailto:linux-nvdimm-request@lists.01.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" <linux-nvdimm-bounces@lists.01.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
"Hotremove" persistent memory
|
expand
|
diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c index a02318c6d28a..4c0131857133 100644 --- a/drivers/dax/kmem.c +++ b/drivers/dax/kmem.c @@ -66,8 +66,11 @@ int dev_dax_kmem_probe(struct device *dev) new_res->name = dev_name(dev); rc = add_memory(numa_node, new_res->start, resource_size(new_res)); - if (rc) + if (rc) { + release_resource(new_res); + kfree(new_res); return rc; + } return 0; }
When add_memory() function fails, the resource and the memory should be freed. Fixes: c221c0b0308f ("device-dax: "Hotplug" persistent memory for use like normal RAM") Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com> --- drivers/dax/kmem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)