1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-06-05 14:30:10 +00:00

arm-bsp/trusted-services: add checks for null attributes in smm gateway

As in EDK-2 and EDK-2 test code, setVariable() with 0
attributes means a delete variable requiest. Currently,
smm gateway doesn't handle this scenario. This commit
adds that support

Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Emekcan
2022-11-07 11:41:47 +00:00
committed by Jon Mason
parent ff583cd9a1
commit 24f2eea0a5
2 changed files with 36 additions and 0 deletions
@@ -0,0 +1,35 @@
From 6d3cac6f3a6e977e9330c9c06514a372ade170a2 Mon Sep 17 00:00:00 2001
From: Emekcan <emekcan.aras@arm.com>
Date: Wed, 2 Nov 2022 09:58:27 +0000
Subject: [PATCH] smm_gateway: add checks for null attributes
As par EDK-2 and EDK-2 test code, setVariable() with 0
attributes means a delete variable request. Currently,
smm gatway doesn't handle this scenario. This commit adds
that support.
Upstream-Status: Pending
Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
---
components/service/smm_variable/backend/uefi_variable_store.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/components/service/smm_variable/backend/uefi_variable_store.c b/components/service/smm_variable/backend/uefi_variable_store.c
index 6c3b9ed8..a691dc5d 100644
--- a/components/service/smm_variable/backend/uefi_variable_store.c
+++ b/components/service/smm_variable/backend/uefi_variable_store.c
@@ -202,9 +202,9 @@ efi_status_t uefi_variable_store_set_variable(
if (info->is_variable_set) {
/* It's a request to update to an existing variable */
- if (!(var->Attributes &
+ if (!(var->Attributes) || (!(var->Attributes &
(EFI_VARIABLE_APPEND_WRITE | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS_MASK)) &&
- !var->DataSize) {
+ !var->DataSize)) {
/* It's a remove operation - for a remove, the variable
* data must be removed from the storage backend before
--
2.17.1
@@ -21,4 +21,5 @@ SRC_URI:append:corstone1000 = " \
file://0018-Fixes-in-AEAD-for-psa-arch-test-54-and-58.patch;patchdir=../trusted-services \
file://0019-plat-corstone1000-change-default-smm-values.patch;patchdir=../trusted-services \
file://0020-FMP-Support-in-Corstone1000.patch;patchdir=../trusted-services \
file://0021-smm_gateway-add-checks-for-null-attributes.patch;patchdir=../trusted-services \
"