U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] efi_loader: variable: attributes may not be changed if a variable exists
Date: Tue, 14 May 2019 08:35:04 +0200	[thread overview]
Message-ID: <df65258f-3ee9-905a-e584-5f7269d37a5e@gmx.de> (raw)
In-Reply-To: <20190514045752.10035-1-takahiro.akashi@linaro.org>

On 5/14/19 6:57 AM, AKASHI Takahiro wrote:
> If a variable already exists, efi_set_variable() should not change
> the variable's attributes. This patch enforces it.

This behavior is mandated by UEFI spec 2.7.

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>   lib/efi_loader/efi_variable.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
>
> diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
> index 37728c3c165d..c4f3a5d2743d 100644
> --- a/lib/efi_loader/efi_variable.c
> +++ b/lib/efi_loader/efi_variable.c
> @@ -450,6 +450,15 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
>   			ret = EFI_WRITE_PROTECTED;
>   			goto out;
>   		}
> +
> +		/*
> +		 * attributes won't be changed
> +		 * TODO: take care of APPEND_WRITE once supported
> +		 */
> +		if (attr != attributes) {
> +			ret = EFI_INVALID_PARAMETER;
> +			goto out;
> +		}
>   	}
>
>   	val = malloc(2 * data_size + strlen("{ro,run,boot}(blob)") + 1);
>

  reply	other threads:[~2019-05-14  6:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-14  4:57 [U-Boot] [PATCH] efi_loader: variable: attributes may not be changed if a variable exists AKASHI Takahiro
2019-05-14  6:35 ` Heinrich Schuchardt [this message]
2019-05-14 18:08   ` Heinrich Schuchardt
2019-05-15  6:09     ` AKASHI Takahiro
2019-05-15 18:48       ` Heinrich Schuchardt

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=df65258f-3ee9-905a-e584-5f7269d37a5e@gmx.de \
    --to=xypron.glpk@gmx.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox