powerpc/fadump: Unregister fadump on kexec down path.
authorMahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Fri, 27 Apr 2018 06:23:18 +0000 (11:53 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 3 May 2018 13:19:30 +0000 (23:19 +1000)
Unregister fadump on kexec down path otherwise the fadump registration
in new kexec-ed kernel complains that fadump is already registered.
This makes new kernel to continue using fadump registered by previous
kernel which may lead to invalid vmcore generation. Hence this patch
fixes this issue by un-registering fadump in fadump_cleanup() which is
called during kexec path so that new kernel can register fadump with
new valid values.

Fixes: b500afff11f6 ("fadump: Invalidate registration and release reserved memory for general use.")
Cc: stable@vger.kernel.org # v3.4+
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/fadump.c

index 8ceabef..07e8396 100644 (file)
@@ -1180,6 +1180,9 @@ void fadump_cleanup(void)
                init_fadump_mem_struct(&fdm,
                        be64_to_cpu(fdm_active->cpu_state_data.destination_address));
                fadump_invalidate_dump(&fdm);
+       } else if (fw_dump.dump_registered) {
+               /* Un-register Firmware-assisted dump if it was registered. */
+               fadump_unregister_dump(&fdm);
        }
 }