Skip to content

Commit 80c6c10

Browse files
jan-kiszkaardbiesheuvel
authored andcommitted
efi: stmm: Do not return EFI_OUT_OF_RESOURCES on internal errors
When we are low on memory or when the internal API is violated, we cannot return EFI_OUT_OF_RESOURCES. According to the UEFI standard, that error code is either related to persistent storage used for the variable or even not foreseen as possible error (GetVariable e.g.). Use the not fully accurate but compliant error code EFI_DEVICE_ERROR in those cases. Signed-off-by: Jan Kiszka <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Acked-by: Sumit Garg <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent c5e81e6 commit 80c6c10

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/firmware/efi/stmm/tee_stmm_efi.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ static efi_status_t get_max_payload(size_t *size)
218218
SMM_VARIABLE_FUNCTION_GET_PAYLOAD_SIZE,
219219
&ret);
220220
if (!var_payload)
221-
return EFI_OUT_OF_RESOURCES;
221+
return EFI_DEVICE_ERROR;
222222

223223
ret = mm_communicate(comm_buf, payload_size);
224224
if (ret != EFI_SUCCESS)
@@ -264,7 +264,7 @@ static efi_status_t get_property_int(u16 *name, size_t name_size,
264264
&comm_buf, payload_size,
265265
SMM_VARIABLE_FUNCTION_VAR_CHECK_VARIABLE_PROPERTY_GET, &ret);
266266
if (!smm_property)
267-
return EFI_OUT_OF_RESOURCES;
267+
return EFI_DEVICE_ERROR;
268268

269269
memcpy(&smm_property->guid, vendor, sizeof(smm_property->guid));
270270
smm_property->name_size = name_size;
@@ -320,7 +320,7 @@ static efi_status_t tee_get_variable(u16 *name, efi_guid_t *vendor,
320320
var_acc = setup_mm_hdr(&comm_buf, payload_size,
321321
SMM_VARIABLE_FUNCTION_GET_VARIABLE, &ret);
322322
if (!var_acc)
323-
return EFI_OUT_OF_RESOURCES;
323+
return EFI_DEVICE_ERROR;
324324

325325
/* Fill in contents */
326326
memcpy(&var_acc->guid, vendor, sizeof(var_acc->guid));
@@ -386,7 +386,7 @@ static efi_status_t tee_get_next_variable(unsigned long *name_size,
386386
SMM_VARIABLE_FUNCTION_GET_NEXT_VARIABLE_NAME,
387387
&ret);
388388
if (!var_getnext)
389-
return EFI_OUT_OF_RESOURCES;
389+
return EFI_DEVICE_ERROR;
390390

391391
/* Fill in contents */
392392
memcpy(&var_getnext->guid, guid, sizeof(var_getnext->guid));
@@ -442,7 +442,7 @@ static efi_status_t tee_set_variable(efi_char16_t *name, efi_guid_t *vendor,
442442
var_acc = setup_mm_hdr(&comm_buf, payload_size,
443443
SMM_VARIABLE_FUNCTION_SET_VARIABLE, &ret);
444444
if (!var_acc)
445-
return EFI_OUT_OF_RESOURCES;
445+
return EFI_DEVICE_ERROR;
446446

447447
/*
448448
* The API has the ability to override RO flags. If no RO check was
@@ -498,7 +498,7 @@ static efi_status_t tee_query_variable_info(u32 attributes,
498498
SMM_VARIABLE_FUNCTION_QUERY_VARIABLE_INFO,
499499
&ret);
500500
if (!mm_query_info)
501-
return EFI_OUT_OF_RESOURCES;
501+
return EFI_DEVICE_ERROR;
502502

503503
mm_query_info->attr = attributes;
504504
ret = mm_communicate(comm_buf, payload_size);

0 commit comments

Comments
 (0)