Message ID | 20190420153148.21548-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 C058F17EE for <patchwork-linux-nvdimm@patchwork.kernel.org>; Sat, 20 Apr 2019 15:31:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD1E028A4B for <patchwork-linux-nvdimm@patchwork.kernel.org>; Sat, 20 Apr 2019 15:31:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A157328B5B; Sat, 20 Apr 2019 15:31:55 +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 61E8C28A4B for <patchwork-linux-nvdimm@patchwork.kernel.org>; Sat, 20 Apr 2019 15:31:55 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5ACA021217967; Sat, 20 Apr 2019 08:31:55 -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::841; helo=mail-qt1-x841.google.com; envelope-from=pasha.tatashin@soleen.com; receiver=linux-nvdimm@lists.01.org Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) (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 CE406212017C8 for <linux-nvdimm@lists.01.org>; Sat, 20 Apr 2019 08:31:53 -0700 (PDT) Received: by mail-qt1-x841.google.com with SMTP id l17so1450266qtp.2 for <linux-nvdimm@lists.01.org>; Sat, 20 Apr 2019 08:31:53 -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=gv4y9y7cf3o267pQaWmOusE3XjrIdET78C/jhvKeJOOIswRYeg+xJ6iCNkoIp7jwe8 eMfmiMGvm3jiItgfWh7rsIC0iDU2arJGD0I8dEWbvohWpSoDYFJHV3UkftKRvGPAoITY i6rIXoLgVSE0QCGGL2ddMLcfig3wKerZ3dju3rIHWGRenLbwMbvtm+Lsy5PzFF4kpInT KtkQO0u2+bNCrI8wkRsYqKOOf0MB81gCxkVmhHSnce37h8lverX4ZAJfovKz65KVuDEZ NQQnlVEnrSOI+B8KgloCauPdOt7A+nn+BGv5pJdp8UVFUN+0TOUYGt5tUHMaPh4tM4jZ hVcw== 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=Le/I5qSyI1UYgQJOfmN7N8C6KEZs9v2sEpvi+o6J2As9+naYp5r/hH10Wt2DbvYemu 7Mf8kGgfPRiqKJF/623tYStfiGnAuYAY0U6L6dLnFwu+SAK7DO02GxDu6qIgUggpIjfI oyxdJxE1Fk8V/uVXMoZ8wPDyKrJwiYMRTrVTPSSb/JOOCnzhD6Ek1XqkHnbSkJeosp2y f8cGaHsJI9rzSRBYla1Vqao27EXTkBbKCMtNI+zrbGBWm0v2O3Tjz1UwUEcaQW96zX/7 fcY8ebVsuYeUbWKZK8by2hefzRo+ZX0K4nr+miiqzRP9lHdgwfvksWat+9J2jQNoByT6 YJ9g== X-Gm-Message-State: APjAAAUBzZxAlbzGYpqfmF6tKRNLryN3Il6fXxTjUlz4dly0dCrc2Z53 LtrWTrHAx4yP7xd22oy4vFwpLQ== X-Google-Smtp-Source: APXvYqy+F9p8F+adABZCVE7+/c6WL6tSVwOuI2/YAflpnkot9CpEHJuJLRjxVI692CvA24SyHzRqyA== X-Received: by 2002:ac8:1aec:: with SMTP id h41mr7984682qtk.345.1555774312594; Sat, 20 Apr 2019 08:31:52 -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 n201sm3976523qka.10.2019.04.20.08.31.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 Apr 2019 08:31:51 -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: [v1 1/2] device-dax: fix memory and resource leak if hotplug fails Date: Sat, 20 Apr 2019 11:31:47 -0400 Message-Id: <20190420153148.21548-2-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190420153148.21548-1-pasha.tatashin@soleen.com> References: <20190420153148.21548-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(-)