From 282177180acf7963f46b6c1d7d2e2e3324055bf8 Mon Sep 17 00:00:00 2001 From: Michal Hocko Date: Mon, 8 Apr 2019 20:35:58 +0800 Subject: [PATCH] mm, memory_hotplug: __offline_pages fix wrong locking mainline inclusion from mainline-5.0-rc5 commit e3df4c6e4836ce93cd5cf92d9cbdeaf4439a0241 category: bugfix bugzilla: 13472 CVE: NA ------------------------------------------------ Jan has noticed that we do double unlock on some failure paths when offlining a page range. This is indeed the case when test_pages_in_a_zone respp. start_isolate_page_range fail. This was an omission when forward porting the debugging patch from an older kernel. Fix the issue by dropping mem_hotplug_done from the failure condition and keeping the single unlock in the catch all failure path. Link: http://lkml.kernel.org/r/20190115120307.22768-1-mhocko@kernel.org Fixes: 7960509329c2 ("mm, memory_hotplug: print reason for the offlining failure") Signed-off-by: Michal Hocko Reported-by: Jan Kara Reviewed-by: Jan Kara Tested-by: Jan Kara Reviewed-by: Oscar Salvador Reviewed-by: Andrew Morton Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: zhong jiang Reviewed-by: Jing Xiangfeng Signed-off-by: Yang Yingliang --- mm/memory_hotplug.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 6a3617d1f588..56f4a42aef83 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1659,7 +1659,6 @@ static int __ref __offline_pages(unsigned long start_pfn, we assume this for now. .*/ if (!test_pages_in_a_zone(start_pfn, end_pfn, &valid_start, &valid_end)) { - mem_hotplug_done(); ret = -EINVAL; reason = "multizone range"; goto failed_removal; @@ -1674,7 +1673,6 @@ static int __ref __offline_pages(unsigned long start_pfn, MIGRATE_MOVABLE, SKIP_HWPOISON | REPORT_FAILURE); if (ret) { - mem_hotplug_done(); reason = "failure to isolate range"; goto failed_removal; } -- GitLab