Commit a2c69837 authored by AKASHI Takahiro's avatar AKASHI Takahiro Committed by Heinrich Schuchardt

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: default avatarAKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
parent dbebae5e
......@@ -451,12 +451,21 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
if (val) {
parse_attr(val, &attr);
/* We should not free val */
val = NULL;
if (attr & READ_ONLY) {
/* We should not free val */
val = NULL;
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment