lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 18 Apr 2017 09:19:23 +0200
From:   Michal Hocko <mhocko@...nel.org>
To:     Jerome Glisse <jglisse@...hat.com>
Cc:     linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
        Mel Gorman <mgorman@...e.de>, Vlastimil Babka <vbabka@...e.cz>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Reza Arbab <arbab@...ux.vnet.ibm.com>,
        Yasuaki Ishimatsu <yasu.isimatu@...il.com>,
        qiuxishi@...wei.com, Kani Toshimitsu <toshi.kani@....com>,
        slaoub@...il.com, Joonsoo Kim <js1304@...il.com>,
        Andi Kleen <ak@...ux.intel.com>,
        David Rientjes <rientjes@...gle.com>,
        Daniel Kiper <daniel.kiper@...cle.com>,
        Igor Mammedov <imammedo@...hat.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Dan Williams <dan.j.williams@...il.com>
Subject: Re: [PATCH 4/9] mm, memory_hotplug: get rid of is_zone_device_section

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 <mhocko@...e.com>
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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ