Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F2EAC282DD for ; Fri, 19 Apr 2019 00:50:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2D3EA21736 for ; Fri, 19 Apr 2019 00:50:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555635019; bh=Ac2gb1nc/1miU+3PcKtPTH7UCZNso17Cf8/ut/aeHKA=; h=Date:From:To:Subject:List-ID:From; b=EYzdd0wci12zr0ZrEg7ja1L/Cq5M+BK3G+Y/LbULahfDMoIxWhqdGnjlt6FMESiTB HeoCOFEnYSPncd5tAVAaY4zeWw6ehOKwNIyBUhJyRkc9upvifzp66Njge21ezrmGq6 riVZnuucFheQ/cvnaMq3OFOPp9hbn8A0sxK4l/5s= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727111AbfDSAuS (ORCPT ); Thu, 18 Apr 2019 20:50:18 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43506 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726822AbfDSAuS (ORCPT ); Thu, 18 Apr 2019 20:50:18 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.8.65]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B5810216B; Fri, 19 Apr 2019 00:50:17 +0000 (UTC) Date: Thu, 18 Apr 2019 17:50:16 -0700 From: akpm@linux-foundation.org To: yangyingliang@huawei.com, stable@vger.kernel.org, osalvador@suse.de, mhocko@suse.com, david@redhat.com, zhongjiang@huawei.com, akpm@linux-foundation.org, mm-commits@vger.kernel.org, torvalds@linux-foundation.org Subject: [patch 06/16] mm/memory_hotplug: do not unlock after failing to take the device_hotplug_lock Message-ID: <20190419005016.C0HPb%akpm@linux-foundation.org> User-Agent: s-nail v14.9.10 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: zhong jiang Subject: mm/memory_hotplug: do not unlock after failing to take the device_hotplug_lock When adding memory by probing a memory block in the sysfs interface, there is an obvious issue where we will unlock the device_hotplug_lock when we failed to takes it. That issue was introduced in 8df1d0e4a265 ("mm/memory_hotplug: make add_memory() take the device_hotplug_lock"). We should drop out in time when failing to take the device_hotplug_lock. Link: http://lkml.kernel.org/r/1554696437-9593-1-git-send-email-zhongjiang@huawei.com Fixes: 8df1d0e4a265 ("mm/memory_hotplug: make add_memory() take the device_hotplug_lock") Signed-off-by: zhong jiang Reported-by: Yang yingliang Acked-by: Michal Hocko Reviewed-by: David Hildenbrand Reviewed-by: Oscar Salvador Cc: Signed-off-by: Andrew Morton --- drivers/base/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/base/memory.c~mm-memory_hotplug-do-not-unlock-when-fails-to-take-the-device_hotplug_lock +++ a/drivers/base/memory.c @@ -506,7 +506,7 @@ static ssize_t probe_store(struct device 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, _