All of lore.kernel.org
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: u-boot@lists.denx.de, Alexander Graf <agraf@csgraf.de>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Masami Hiramatsu <masami.hiramatsu@linaro.org>
Subject: Re: [PATCH 1/1] efi_loader: segfault in efi_clear_os_indications()
Date: Wed, 24 Nov 2021 11:53:14 +0900	[thread overview]
Message-ID: <20211124025314.GA9598@laputa> (raw)
In-Reply-To: <20211120110225.40663-1-heinrich.schuchardt@canonical.com>

On Sat, Nov 20, 2021 at 12:02:25PM +0100, Heinrich Schuchardt wrote:
> If we call efi_clear_os_indications() before initializing the memory store
> for UEFI variables a NULL pointer dereference occurs.
> 
> The error was observed on the sandbox with:
> 
>     usb start
>     host bind 0 sandbox.img
>     load host 0:1 $kernel_addr_r helloworld.efi
>     bootefi $kernel_addr_r
> 
> Here efi_resister_disk() failed due to an error in the BTRFS implementation.
> 
> It is enough to clear EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED
> if we have successfully initialized the UEFI sub-system.

I think that it would be better move this function into
efi_launch_capsules() as we should defer to a responsible sub-component,
capsule support in this case, on whether a particular bit should be cleared.

-Takahiro Akashi

> Fixes: 149108a3eb59 ("efi_loader: clear OsIndications")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  lib/efi_loader/efi_setup.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
> index a2338d74af..661868811f 100644
> --- a/lib/efi_loader/efi_setup.c
> +++ b/lib/efi_loader/efi_setup.c
> @@ -331,11 +331,10 @@ efi_status_t efi_init_obj_list(void)
>  	if (IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK) &&
>  	    !IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK_EARLY))
>  		ret = efi_launch_capsules();
> -
> -out:
>  	r = efi_clear_os_indications();
>  	if (ret == EFI_SUCCESS)
>  		ret = r;
> +out:
>  	efi_obj_list_initialized = ret;
>  	return ret;
>  }
> -- 
> 2.32.0
> 

      reply	other threads:[~2021-11-24  2:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-20 11:02 [PATCH 1/1] efi_loader: segfault in efi_clear_os_indications() Heinrich Schuchardt
2021-11-24  2:53 ` AKASHI Takahiro [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211124025314.GA9598@laputa \
    --to=takahiro.akashi@linaro.org \
    --cc=agraf@csgraf.de \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=masami.hiramatsu@linaro.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.