summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr.tyminski <r.tyminski@partner.samsung.com>2017-06-05 13:12:39 +0200
committerr.tyminski <r.tyminski@partner.samsung.com>2017-06-05 13:12:39 +0200
commit0e177cc136b971af11953a84e10f5489e5557579 (patch)
treeeb11c3ae9a5bddefdaef0d8af9c94d0fe55b15fd
parent520d2c0ac67ccf9fdc73a1d1cc56876bf0e580b7 (diff)
downloadtef-optee_client-0e177cc136b971af11953a84e10f5489e5557579.tar.gz
tef-optee_client-0e177cc136b971af11953a84e10f5489e5557579.tar.bz2
tef-optee_client-0e177cc136b971af11953a84e10f5489e5557579.zip
Update from upstream to 2.4.0 versionupstream/2.4.0upstream
Change-Id: I748163170cec3409645e3990c4c2d774b01f349f
-rw-r--r--tee-supplicant/src/tee_supp_fs.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/tee-supplicant/src/tee_supp_fs.c b/tee-supplicant/src/tee_supp_fs.c
index ba8b805..bd1a220 100644
--- a/tee-supplicant/src/tee_supp_fs.c
+++ b/tee-supplicant/src/tee_supp_fs.c
@@ -726,6 +726,8 @@ static TEEC_Result ree_fs_new_opendir(size_t num_params,
char *fname;
DIR *dir;
int handle;
+ struct dirent *dent;
+ bool empty = true;
if (num_params != 3 ||
(params[0].attr & TEE_IOCTL_PARAM_ATTR_TYPE_MASK) !=
@@ -748,6 +750,30 @@ static TEEC_Result ree_fs_new_opendir(size_t num_params,
if (!dir)
return TEEC_ERROR_ITEM_NOT_FOUND;
+ /*
+ * Ignore empty directories. Works around an issue when the
+ * data path is mounted over NFS. Due to the way OP-TEE implements
+ * TEE_CloseAndDeletePersistentObject1() currently, tee-supplicant
+ * still has a file descriptor open to the file when it's removed in
+ * ree_fs_new_remove(). In this case the NFS server may create a
+ * temporary reference called .nfs????, and the rmdir() call fails
+ * so that the TA directory is left over. Checking this special case
+ * here avoids that TEE_StartPersistentObjectEnumerator() returns
+ * TEE_SUCCESS when it should return TEEC_ERROR_ITEM_NOT_FOUND.
+ * Test case: "xtest 6009 6010".
+ */
+ while ((dent = readdir(dir))) {
+ if (dent->d_name[0] == '.')
+ continue;
+ empty = false;
+ break;
+ }
+ if (empty) {
+ closedir(dir);
+ return TEEC_ERROR_ITEM_NOT_FOUND;
+ }
+ rewinddir(dir);
+
handle = handle_get(&dir_handle_db, dir);
if (handle < 0) {
closedir(dir);