linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESENT PATCH] mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock
@ 2019-04-08  4:07 zhong jiang
  2019-04-08  5:42 ` Michal Hocko
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: zhong jiang @ 2019-04-08  4:07 UTC (permalink / raw)
  To: akpm, rafael, david, rafael.j.wysocki, mhocko, osalvador
  Cc: vbabka, iamjoonsoo.kim, bsingharora, gregkh, yangyingliang,
	linux-kernel, linux-mm

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 <yangyingliang@huawei.com>
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 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 d9ebb89..0c9e22f 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -507,7 +507,7 @@ static ssize_t 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,
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RESENT PATCH] mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock
  2019-04-08  4:07 [RESENT PATCH] mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock zhong jiang
@ 2019-04-08  5:42 ` Michal Hocko
  2019-04-08  7:05 ` David Hildenbrand
  2019-04-08  7:27 ` Oscar Salvador
  2 siblings, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2019-04-08  5:42 UTC (permalink / raw)
  To: zhong jiang
  Cc: akpm, rafael, david, rafael.j.wysocki, osalvador, vbabka,
	iamjoonsoo.kim, bsingharora, gregkh, yangyingliang, linux-kernel,
	linux-mm

On Mon 08-04-19 12:07:17, zhong jiang wrote:
> 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 <yangyingliang@huawei.com>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  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 d9ebb89..0c9e22f 100644
> --- a/drivers/base/memory.c
> +++ b/drivers/base/memory.c
> @@ -507,7 +507,7 @@ static ssize_t 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,
> -- 
> 1.7.12.4
> 

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RESENT PATCH] mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock
  2019-04-08  4:07 [RESENT PATCH] mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock zhong jiang
  2019-04-08  5:42 ` Michal Hocko
@ 2019-04-08  7:05 ` David Hildenbrand
  2019-04-08  7:27 ` Oscar Salvador
  2 siblings, 0 replies; 4+ messages in thread
From: David Hildenbrand @ 2019-04-08  7:05 UTC (permalink / raw)
  To: zhong jiang, akpm, rafael, rafael.j.wysocki, mhocko, osalvador
  Cc: vbabka, iamjoonsoo.kim, bsingharora, gregkh, yangyingliang,
	linux-kernel, linux-mm

On 08.04.19 06:07, zhong jiang wrote:
> 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 <yangyingliang@huawei.com>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  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 d9ebb89..0c9e22f 100644
> --- a/drivers/base/memory.c
> +++ b/drivers/base/memory.c
> @@ -507,7 +507,7 @@ static ssize_t 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,
> 

Indeed

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 

Thanks,

David / dhildenb

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RESENT PATCH] mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock
  2019-04-08  4:07 [RESENT PATCH] mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock zhong jiang
  2019-04-08  5:42 ` Michal Hocko
  2019-04-08  7:05 ` David Hildenbrand
@ 2019-04-08  7:27 ` Oscar Salvador
  2 siblings, 0 replies; 4+ messages in thread
From: Oscar Salvador @ 2019-04-08  7:27 UTC (permalink / raw)
  To: zhong jiang
  Cc: akpm, rafael, david, rafael.j.wysocki, mhocko, vbabka,
	iamjoonsoo.kim, bsingharora, gregkh, yangyingliang, linux-kernel,
	linux-mm

On Mon, Apr 08, 2019 at 12:07:17PM +0800, zhong jiang wrote:
> 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 <yangyingliang@huawei.com>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>

Reviewed-by: Oscar Salvador <osalvador@suse.de>

-- 
Oscar Salvador
SUSE L3

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-08  7:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-08  4:07 [RESENT PATCH] mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock zhong jiang
2019-04-08  5:42 ` Michal Hocko
2019-04-08  7:05 ` David Hildenbrand
2019-04-08  7:27 ` Oscar Salvador

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).