Skip to content

Commit

Permalink
core: fix error handling in tee_svc_storage_read_head()
Browse files Browse the repository at this point in the history
Prior to this all errors except TEE_ERROR_OUT_OF_MEMORY from
fops->read() was reported as TEE_ERROR_CORRUPT_OBJECT leading
to removal of the object.
We should not treat all errors as corrupt, so remove the error
code translation.

Signed-off-by: Pengguang Zhu <[email protected]>
Reviewed-by: Jerome Forissier <[email protected]>
Reviewed-by: Jens Wiklander <[email protected]>
  • Loading branch information
Pengguang Zhu authored and jforissier committed Aug 28, 2024
1 parent 931c8c5 commit 71ecb9f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/tee/tee_svc_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ static TEE_Result tee_svc_storage_read_head(struct tee_obj *o)
bytes = head.attr_size;
res = fops->read(o->fh, sizeof(struct tee_svc_storage_head),
attr, NULL, &bytes);
if (res == TEE_ERROR_OUT_OF_MEMORY)
if (res != TEE_SUCCESS)
goto exit;
if (res != TEE_SUCCESS || bytes != head.attr_size)
if (bytes != head.attr_size) {
res = TEE_ERROR_CORRUPT_OBJECT;
if (res)
goto exit;
}
}

res = tee_obj_attr_from_binary(o, attr, head.attr_size);
Expand Down

0 comments on commit 71ecb9f

Please sign in to comment.