Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp737734ybc; Sat, 16 Nov 2019 07:50:29 -0800 (PST) X-Google-Smtp-Source: APXvYqxXSJ+7KNUKLHTvyaILGodhwmx5yyoscP2CITuqfuk6JqQe3YXwusofqkyPmJy6K5rMBXi/ X-Received: by 2002:a17:907:212a:: with SMTP id qo10mr6826428ejb.197.1573919429187; Sat, 16 Nov 2019 07:50:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573919429; cv=none; d=google.com; s=arc-20160816; b=EBCl7BOzuA65lw8K+yIo9vhALXSZUAGXcKSJDEU4cIlj8jSyg4INagcRYtPps9fDly MtFHgkzVNDMJgAEj4vSGUglIFpMkN1IJlWA5WsUU59RdExxdDUu7BXwQeVWj6x2UO5fU jOvTRn1fb/Nf2RuqGzmCJ/y/tjJxJX5Kb2Vmh9uHoaAdgYwSrQG1P2ZGstPfCwFboGPV G7+zg90yls66zKP2re5AOZn+Iy5FECyD2kMo4J6kOn7zkP2KXPLEvlufXcEaROAuZigo f0ciNHDLnmbN7I4ROjf9phYNUGKjIy4N0f18botuuvGUHwy43V35Rc9ZsUGGKHyMO9MT 23fQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vDsiCLUrKGKcnxMEAIuLXniQ4sQSSkp6BIXbjhlMFdg=; b=s3WlEOdh1b4yANQkiwJsku11IaLztwFKYh7rLQwk7D62mGJDZeKJF62f+dPqYOTuQr ycAOG/vKKdeOScxzLmGevov1/nVzA4Z0vCJEGXB972XX5awbcEaXdBJT8Mt0aXJ3hC8W XrJQZzZgRokZ7zY5mxE4tr1Q+W5r6QJUA1ny4AZ4MJiMbwg6VVHTys/kufLd/2kR42QS Xm/Kow27fNU3yO+ml30H1EdJrtqeyee3tbjfT1/GstMZ5ojVMg26PFgP+wY3zh0rzWE9 foImJgQgUeK8nFlkglsU+Nfht7XVcYQuu8Qc8zd9sa+VFS3Q6SLsq3t4CRCYIzNqV6+g Wzkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hOMK+7bJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b28si11246887edc.400.2019.11.16.07.50.04; Sat, 16 Nov 2019 07:50:29 -0800 (PST) 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=hOMK+7bJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729804AbfKPPrq (ORCPT + 99 others); Sat, 16 Nov 2019 10:47:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:53746 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729623AbfKPPrK (ORCPT ); Sat, 16 Nov 2019 10:47:10 -0500 Received: from sasha-vm.mshome.net (unknown [50.234.116.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E11F820885; Sat, 16 Nov 2019 15:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573919230; bh=L4QbWVzfIJSe4VDi2e6Gwm+s3G1sQIYBlYSwyB3DNpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hOMK+7bJZrnZQyLoEeGWcHaOOwSAD8KzAd2W59iXwKfaIANCS/V9sP8hKA6fp6zH+ 8WiRX3CiJkCPGgZfm14pv5LGgBpa6d6MJtH8TZmV8CsSbBxJpMtTaz13ZNsGblLB3Q iGim2DUMrNTIg3qyiBd4Pk5LgeZFU0w/rwifdMEc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: zhong jiang , Yang yingliang , Oscar Salvador , David Hildenbrand , Michal Hocko , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH AUTOSEL 4.19 235/237] mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock Date: Sat, 16 Nov 2019 10:41:10 -0500 Message-Id: <20191116154113.7417-235-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191116154113.7417-1-sashal@kernel.org> References: <20191116154113.7417-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: zhong jiang [ Upstream commit d2ab99403ee00d8014e651728a4702ea1ae5e52c ] When adding the memory by probing memory block in sysfs interface, there is an obvious issue that we will unlock the device_hotplug_lock when fails to takes it. That issue was introduced in Commit 8df1d0e4a265 ("mm/memory_hotplug: make add_memory() take the device_hotplug_lock") We should drop out in time when fails to take the device_hotplug_lock. Fixes: 8df1d0e4a265 ("mm/memory_hotplug: make add_memory() take the device_hotplug_lock") Reported-by: Yang yingliang Signed-off-by: zhong jiang Reviewed-by: Oscar Salvador Reviewed-by: David Hildenbrand Acked-by: Michal Hocko Cc: stable Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/base/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 0f8e77f78cc80..ac1574a696100 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -510,7 +510,7 @@ memory_probe_store(struct device *dev, struct device_attribute *attr, ret = lock_device_hotplug_sysfs(); if (ret) - goto out; + return ret; nid = memory_add_physaddr_to_nid(phys_addr); ret = __add_memory(nid, phys_addr, -- 2.20.1