Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1625096
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 4/9] mm, memory_hotplug: get rid of is_zone_device_section |
| Date | 2017-04-18 09:20 +0200 |
| Message-ID | <txvAC-3i3-17@gated-at.bofh.it> (permalink) |
| References | <tuFmO-8iD-7@gated-at.bofh.it> <tuFmP-8iD-29@gated-at.bofh.it> <txlhU-59s-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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@suse.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
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH 4/9] mm, memory_hotplug: get rid of is_zone_device_section Jerome Glisse <jglisse@redhat.com> - 2017-04-17 22:20 +0200 Re: [PATCH 4/9] mm, memory_hotplug: get rid of is_zone_device_section Michal Hocko <mhocko@kernel.org> - 2017-04-18 09:20 +0200
csiph-web