]> git.hungrycats.org Git - linux/commitdiff
efi/libstub: Free correct pointer on failure
authorArd Biesheuvel <ardb@kernel.org>
Sun, 13 Oct 2024 13:19:04 +0000 (15:19 +0200)
committerArd Biesheuvel <ardb@kernel.org>
Fri, 15 Nov 2024 09:40:51 +0000 (10:40 +0100)
cmdline_ptr is an out parameter, which is not allocated by the function
itself, and likely points into the caller's stack.

cmdline refers to the pool allocation that should be freed when cleaning
up after a failure, so pass this instead to free_pool().

Fixes: 42c8ea3dca09 ("efi: libstub: Factor out EFI stub entrypoint ...")
Cc: <stable@vger.kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/libstub/efi-stub.c

index f09e277ba2108825a60079ef77dbe570011d574b..fc71dcab43e031cbeefe2130c681aa5346b4592b 100644 (file)
@@ -148,7 +148,7 @@ efi_status_t efi_handle_cmdline(efi_loaded_image_t *image, char **cmdline_ptr)
        return EFI_SUCCESS;
 
 fail_free_cmdline:
-       efi_bs_call(free_pool, cmdline_ptr);
+       efi_bs_call(free_pool, cmdline);
        return status;
 }