Skip to content

Commit

Permalink
[BugFix]: Add ruturn value check for fs_unlink
Browse files Browse the repository at this point in the history
[Desc]:
1. check_storage_available should check fs_unlink's return value;
2. ta_storage_cmd_unlink should't always return TEE_SUCCESS;

Signed-off-by: pengyinjie <pengyinjie@xiaomi.com>
  • Loading branch information
XMPengYinjie committed Apr 25, 2024
1 parent 50e1cbd commit 94f5830
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion host/xtest/regression_6000.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ static TEEC_Result check_storage_available(uint32_t id, bool *avail)
switch (res) {
case TEEC_SUCCESS:
*avail = true;
fs_unlink(&sess, obj);
res = fs_unlink(&sess, obj);
break;
case TEE_ERROR_ITEM_NOT_FOUND:
case TEE_ERROR_STORAGE_NOT_AVAILABLE:
Expand Down
5 changes: 3 additions & 2 deletions ta/storage/storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,16 @@ TEE_Result ta_storage_cmd_seek(uint32_t param_types, TEE_Param params[4])

TEE_Result ta_storage_cmd_unlink(uint32_t param_types, TEE_Param params[4])
{
TEE_Result res = TEE_ERROR_GENERIC;
TEE_ObjectHandle o = VAL2HANDLE(params[0].value.a);

ASSERT_PARAM_TYPE(TEE_PARAM_TYPES
(TEE_PARAM_TYPE_VALUE_INPUT, TEE_PARAM_TYPE_NONE,
TEE_PARAM_TYPE_NONE, TEE_PARAM_TYPE_NONE));

TEE_CloseAndDeletePersistentObject1(o);
res = TEE_CloseAndDeletePersistentObject1(o);

return TEE_SUCCESS;
return res;
}

TEE_Result ta_storage_cmd_rename(uint32_t command, uint32_t param_types,
Expand Down

0 comments on commit 94f5830

Please sign in to comment.