]> git.hungrycats.org Git - linux/commit
efi/libstub: Free correct pointer on failure
authorArd Biesheuvel <ardb@kernel.org>
Sun, 13 Oct 2024 13:19:04 +0000 (15:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Dec 2024 09:33:03 +0000 (10:33 +0100)
commitd173aee5709bd0994d216d60589ec67f8b11376a
tree6c3a8154f7574e938cfc947a14a11f882219e725
parent5262cbf40264a22ea96b0123a963c654a30f1f15
efi/libstub: Free correct pointer on failure

commit 06d39d79cbd5a91a33707951ebf2512d0e759847 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/firmware/efi/libstub/efi-stub.c