]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
lib/test_kho: check if KHO is enabled
authorPasha Tatashin <pasha.tatashin@soleen.com>
Thu, 6 Nov 2025 22:06:35 +0000 (17:06 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Dec 2025 10:45:37 +0000 (11:45 +0100)
commit a26ec8f3d4e56d4a7ffa301e8032dca9df0bbc05 upstream.

We must check whether KHO is enabled prior to issuing KHO commands,
otherwise KHO internal data structures are not initialized.

Link: https://lkml.kernel.org/r/20251106220635.2608494-1-pasha.tatashin@soleen.com
Fixes: b753522bed0b ("kho: add test for kexec handover")
Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202511061629.e242724-lkp@intel.com
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Alexander Graf <graf@amazon.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
lib/test_kho.c

index c2eb899c3b456a38a54e1b8b442bf01d7d5aadc3..bab9bb1df73f891bef57fc4689f1eed4435a998d 100644 (file)
@@ -272,6 +272,9 @@ static int __init kho_test_init(void)
        phys_addr_t fdt_phys;
        int err;
 
+       if (!kho_is_enabled())
+               return 0;
+
        err = kho_retrieve_subtree(KHO_TEST_FDT, &fdt_phys);
        if (!err)
                return kho_test_restore(fdt_phys);