diff options
author | r.tyminski <r.tyminski@partner.samsung.com> | 2017-06-05 12:44:25 +0200 |
---|---|---|
committer | r.tyminski <r.tyminski@partner.samsung.com> | 2017-06-05 12:44:25 +0200 |
commit | 146aec115cd05a164a88e6d7b07435c57a33817f (patch) | |
tree | d8099075c92576b1928069af274f9b833aca996e /core/tee/tee_pobj.c | |
parent | f9a43781767007462965b21f3f518c4cfc0744c7 (diff) | |
download | tef-optee_os-146aec115cd05a164a88e6d7b07435c57a33817f.tar.gz tef-optee_os-146aec115cd05a164a88e6d7b07435c57a33817f.tar.bz2 tef-optee_os-146aec115cd05a164a88e6d7b07435c57a33817f.zip |
Update from upstream to 2.4.0 versionupstream/2.4.0upstream
Change-Id: I2b3a30f20684d6629fe379d9cd7895aff759c301
Diffstat (limited to 'core/tee/tee_pobj.c')
-rw-r--r-- | core/tee/tee_pobj.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/core/tee/tee_pobj.c b/core/tee/tee_pobj.c index a7aee31..0f9fb46 100644 --- a/core/tee/tee_pobj.c +++ b/core/tee/tee_pobj.c @@ -80,7 +80,8 @@ static TEE_Result tee_pobj_check_access(uint32_t oflags, uint32_t nflags) } TEE_Result tee_pobj_get(TEE_UUID *uuid, void *obj_id, uint32_t obj_id_len, - uint32_t flags, const struct tee_file_operations *fops, + uint32_t flags, bool temporary, + const struct tee_file_operations *fops, struct tee_pobj **obj) { struct tee_pobj *o; @@ -100,10 +101,12 @@ TEE_Result tee_pobj_get(TEE_UUID *uuid, void *obj_id, uint32_t obj_id_len, } if (*obj) { + if (temporary != (*obj)->temporary) { + res = TEE_ERROR_ACCESS_CONFLICT; + goto out; + } res = tee_pobj_check_access((*obj)->flags, flags); - if (res != TEE_SUCCESS) - *obj = NULL; - else + if (res == TEE_SUCCESS) (*obj)->refcnt++; goto out; } @@ -119,6 +122,7 @@ TEE_Result tee_pobj_get(TEE_UUID *uuid, void *obj_id, uint32_t obj_id_len, memcpy(&o->uuid, uuid, sizeof(TEE_UUID)); o->flags = flags; o->fops = fops; + o->temporary = temporary; o->obj_id = malloc(obj_id_len); if (o->obj_id == NULL) { @@ -134,6 +138,8 @@ TEE_Result tee_pobj_get(TEE_UUID *uuid, void *obj_id, uint32_t obj_id_len, res = TEE_SUCCESS; out: + if (res != TEE_SUCCESS) + *obj = NULL; mutex_unlock(&pobjs_mutex); return res; } |