On Mon 17-04-17 16:12:35, Jerome Glisse wrote:
[...]
> > @@ -741,11 +730,16 @@ static int remove_memory_section(unsigned long 
> > node_id,
> >  {
> >     struct memory_block *mem;
> >  
> > -   if (is_zone_device_section(section))
> > -           return 0;
> > -
> >     mutex_lock(&mem_sysfs_mutex);
> > +
> > +   /*
> > +    * Some users of the memory hotplug do not want/need memblock to
> > +    * track all sections. Skip over those.
> > +    */
> >     mem = find_memory_block(section);
> > +   if (!mem)
> > +           return 0;
> > +
> 
> Another bug above spoted by Evgeny Baskakov from NVidia, mutex unlock
> is missing ie something like:
> 
> if (!mem) {
>       mutex_unlock(&mem_sysfs_mutex);
>       return 0;
> }

Thanks for spotting this. I went with the following fixup
---
>From 38efdaf68b5c79df953385e9385581f75d46e651 Mon Sep 17 00:00:00 2001
From: Michal Hocko <[email protected]>
Date: Tue, 18 Apr 2017 09:17:31 +0200
Subject: [PATCH] fold me "mm, memory_hotplug: get rid of
 is_zone_device_section"

- fix remove_memory_section unlock on find_memory_block failure
  as per Jerome - spotted by Evgeny Baskakov
---
 drivers/base/memory.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 45c25e2e3da4..5ae81617f11d 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -746,7 +746,7 @@ static int remove_memory_section(unsigned long node_id,
         */
        mem = find_memory_block(section);
        if (!mem)
-               return 0;
+               goto out_unlock;
 
        unregister_mem_sect_under_nodes(mem, __section_nr(section));
 
@@ -756,6 +756,7 @@ static int remove_memory_section(unsigned long node_id,
        else
                put_device(&mem->dev);
 
+out_unlock:
        mutex_unlock(&mem_sysfs_mutex);
        return 0;
 }
-- 
2.11.0

> Between when are you planning on reposting ?

this weak, the sooner the better.

Thanks!
-- 
Michal Hocko
SUSE Labs

Reply via email to