Skip to content

Commit 06d39d7

Browse files
committed
efi/libstub: Free correct pointer on failure
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: 42c8ea3 ("efi: libstub: Factor out EFI stub entrypoint ...") Cc: <stable@vger.kernel.org> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent 63971b0 commit 06d39d7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/firmware/efi/libstub/efi-stub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ efi_status_t efi_handle_cmdline(efi_loaded_image_t *image, char **cmdline_ptr)
148148
return EFI_SUCCESS;
149149

150150
fail_free_cmdline:
151-
efi_bs_call(free_pool, cmdline_ptr);
151+
efi_bs_call(free_pool, cmdline);
152152
return status;
153153
}
154154

0 commit comments

Comments
 (0)