powerpc/pseries: Advance pfn if section is not present in lmb_is_removable()
authorPingfan Liu <kernelfans@gmail.com>
Fri, 10 Jan 2020 04:54:02 +0000 (12:54 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Feb 2020 21:31:00 +0000 (16:31 -0500)
commit fbee6ba2dca30d302efe6bddb3a886f5e964a257 upstream.

In lmb_is_removable(), if a section is not present, it should continue
to test the rest of the sections in the block. But the current code
fails to do so.

Fixes: 51925fb3c5c9 ("powerpc/pseries: Implement memory hotplug remove in the kernel")
Cc: stable@vger.kernel.org # v4.1+
Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/1578632042-12415-1-git-send-email-kernelfans@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/platforms/pseries/hotplug-memory.c

index 6c12b02..eee45b9 100644 (file)
@@ -398,8 +398,10 @@ static bool lmb_is_removable(struct of_drconf_cell *lmb)
 
        for (i = 0; i < scns_per_block; i++) {
                pfn = PFN_DOWN(phys_addr);
-               if (!pfn_present(pfn))
+               if (!pfn_present(pfn)) {
+                       phys_addr += MIN_MEMORY_BLOCK_SIZE;
                        continue;
+               }
 
                rc &= is_mem_section_removable(pfn, PAGES_PER_SECTION);
                phys_addr += MIN_MEMORY_BLOCK_SIZE;