[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190621193834.21730-1-david@redhat.com>
Date: Fri, 21 Jun 2019 21:38:34 +0200
From: David Hildenbrand <david@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: David Hildenbrand <david@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>, linux-mm@...ck.org,
Qian Cai <cai@....pw>
Subject: [PATCH] drivers/base/memory.c: Fix "mm/memory_hotplug: Move and simplify walk_memory_blocks()"
The start and the size are 0 for online nodes without any memory. Avoid
the underflow, resulting in a very long loop and soft lockups.
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Stephen Rothwell <sfr@...b.auug.org.au>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: linux-mm@...ck.org
Reported-by: Qian Cai <cai@....pw>
Signed-off-by: David Hildenbrand <david@...hat.com>
---
@Andrew, Stephen - sorry for the noise *again*. Feel feel to either apply
this patch or drop the respective patches for now.
---
drivers/base/memory.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 972c5336bebf..7595a4f0068f 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -868,6 +868,9 @@ int walk_memory_blocks(unsigned long start, unsigned long size,
unsigned long block_id;
int ret = 0;
+ if (!size)
+ return 0;
+
for (block_id = start_block_id; block_id <= end_block_id; block_id++) {
mem = find_memory_block_by_id(block_id);
if (!mem)
--
2.21.0
Powered by blists - more mailing lists