mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-07-04 13:22:31 +00:00
efi_loader: variable: attributes may not be changed if a variable exists
If a variable already exists, efi_set_variable() should not change the variable's attributes. This patch enforces it. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
parent
dbebae5ec7
commit
a2c6983740
1 changed files with 11 additions and 2 deletions
|
@ -451,12 +451,21 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
|
||||||
if (val) {
|
if (val) {
|
||||||
parse_attr(val, &attr);
|
parse_attr(val, &attr);
|
||||||
|
|
||||||
if (attr & READ_ONLY) {
|
|
||||||
/* We should not free val */
|
/* We should not free val */
|
||||||
val = NULL;
|
val = NULL;
|
||||||
|
if (attr & READ_ONLY) {
|
||||||
ret = EFI_WRITE_PROTECTED;
|
ret = EFI_WRITE_PROTECTED;
|
||||||
goto out;
|
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);
|
val = malloc(2 * data_size + strlen("{ro,run,boot}(blob)") + 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue