Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 1 | From 6d3cac6f3a6e977e9330c9c06514a372ade170a2 Mon Sep 17 00:00:00 2001 |
| 2 | From: Emekcan <emekcan.aras@arm.com> |
| 3 | Date: Wed, 2 Nov 2022 09:58:27 +0000 |
| 4 | Subject: [PATCH] smm_gateway: add checks for null attributes |
| 5 | |
| 6 | As par EDK-2 and EDK-2 test code, setVariable() with 0 |
| 7 | attributes means a delete variable request. Currently, |
| 8 | smm gatway doesn't handle this scenario. This commit adds |
| 9 | that support. |
| 10 | |
| 11 | Upstream-Status: Pending |
| 12 | Signed-off-by: Emekcan Aras <emekcan.aras@arm.com> |
| 13 | --- |
| 14 | components/service/smm_variable/backend/uefi_variable_store.c | 4 ++-- |
| 15 | 1 file changed, 2 insertions(+), 2 deletions(-) |
| 16 | |
| 17 | diff --git a/components/service/smm_variable/backend/uefi_variable_store.c b/components/service/smm_variable/backend/uefi_variable_store.c |
| 18 | index 6c3b9ed8..a691dc5d 100644 |
| 19 | --- a/components/service/smm_variable/backend/uefi_variable_store.c |
| 20 | +++ b/components/service/smm_variable/backend/uefi_variable_store.c |
| 21 | @@ -202,9 +202,9 @@ efi_status_t uefi_variable_store_set_variable( |
| 22 | if (info->is_variable_set) { |
| 23 | |
| 24 | /* It's a request to update to an existing variable */ |
| 25 | - if (!(var->Attributes & |
| 26 | + if (!(var->Attributes) || (!(var->Attributes & |
| 27 | (EFI_VARIABLE_APPEND_WRITE | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS_MASK)) && |
| 28 | - !var->DataSize) { |
| 29 | + !var->DataSize)) { |
| 30 | |
| 31 | /* It's a remove operation - for a remove, the variable |
| 32 | * data must be removed from the storage backend before |
| 33 | -- |
| 34 | 2.17.1 |
| 35 | |