diff options
author | Arvind Sankar <nivedita@alum.mit.edu> | 2020-04-30 20:28:43 +0200 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2020-05-01 09:40:02 +0200 |
commit | 055042bedd4e0af8186266b189b81e73e708b82b (patch) | |
tree | 76c9b95853fec86fc172c05bdf3d516fdb3c035a /drivers/firmware/efi/libstub/x86-stub.c | |
parent | efi/x86: Support builtin command line (diff) | |
download | linux-055042bedd4e0af8186266b189b81e73e708b82b.tar.xz linux-055042bedd4e0af8186266b189b81e73e708b82b.zip |
efi/libstub: Check return value of efi_parse_options
efi_parse_options can fail if it is unable to allocate space for a copy
of the command line. Check the return value to make sure it succeeded.
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Link: https://lore.kernel.org/r/20200430182843.2510180-12-nivedita@alum.mit.edu
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'drivers/firmware/efi/libstub/x86-stub.c')
-rw-r--r-- | drivers/firmware/efi/libstub/x86-stub.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c index c84c5678e3e1..37154bb93c59 100644 --- a/drivers/firmware/efi/libstub/x86-stub.c +++ b/drivers/firmware/efi/libstub/x86-stub.c @@ -739,12 +739,20 @@ unsigned long efi_main(efi_handle_t handle, } #ifdef CONFIG_CMDLINE_BOOL - efi_parse_options(CONFIG_CMDLINE); + status = efi_parse_options(CONFIG_CMDLINE); + if (status != EFI_SUCCESS) { + efi_err("Failed to parse options\n"); + goto fail; + } #endif if (!IS_ENABLED(CONFIG_CMDLINE_OVERRIDE)) { unsigned long cmdline_paddr = ((u64)hdr->cmd_line_ptr | ((u64)boot_params->ext_cmd_line_ptr << 32)); - efi_parse_options((char *)cmdline_paddr); + status = efi_parse_options((char *)cmdline_paddr); + if (status != EFI_SUCCESS) { + efi_err("Failed to parse options\n"); + goto fail; + } } /* |