diff options
author | Ilias Apalodimas <apalos@gmail.com> | 2024-04-03 18:43:53 +0300 |
---|---|---|
committer | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2024-04-08 13:03:37 +0200 |
commit | 6b0f194648f0f11281c01fb570d30931e6c3a13e (patch) | |
tree | a4c83030da005d3438c16268ee8e112f75b59b66 | |
parent | e0fa2cf39cedd9297c16bc4ea4ff5c512bb4e0ec (diff) | |
download | u-boot-6b0f194648f0f11281c01fb570d30931e6c3a13e.zip u-boot-6b0f194648f0f11281c01fb570d30931e6c3a13e.tar.gz u-boot-6b0f194648f0f11281c01fb570d30931e6c3a13e.tar.bz2 |
efi_loader: Don't delete variable from memory if adding a new one failed
Our efi_var_mem_xxx() functions don't have a replace variant. Instead we
add a new variable and delete the old instance when trying to replace a
variable. Currently we delete the old version without checking the new
one got added
Signed-off-by: Ilias Apalodimas <apalos@gmail.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
-rw-r--r-- | lib/efi_loader/efi_variable.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index 6fe3792..2951dc7 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -360,11 +360,12 @@ efi_status_t efi_set_variable_int(const u16 *variable_name, ret = efi_var_mem_ins(variable_name, vendor, attributes, data_size, data, 0, NULL, time); } - efi_var_mem_del(var); if (ret != EFI_SUCCESS) return ret; + efi_var_mem_del(var); + if (var_type == EFI_AUTH_VAR_PK) ret = efi_init_secure_state(); else |