diff options
author | Jens Wiklander <jens.wiklander@linaro.org> | 2018-05-14 10:43:13 +0200 |
---|---|---|
committer | Jérôme Forissier <jerome.forissier@linaro.org> | 2018-05-14 12:57:12 +0200 |
commit | f678d2cd51721de91f8594c456b168d17573a9f8 (patch) | |
tree | 115bfeefa2b9aaec148cc6151308aa6bdec4a2ac /core/tee | |
parent | bce296df0de6c18ce9ce4044345e424ba2533d7f (diff) |
core: fix OOM handling in tee_svc_storage_read_head()
Fixes out of memory handling error in tee_svc_storage_read_head(). Prior
to this all errors from fops->read() was reported as
TEE_ERROR_CORRUPT_OBJECT leading to removal of the object even when the
real problem was temporary memory shortage. This patch reports
TEE_ERROR_OUT_OF_MEMORY from fops->read() correctly while translating
all other errors to TEE_ERROR_CORRUPT_OBJECT.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'core/tee')
-rw-r--r-- | core/tee/tee_svc_storage.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/tee/tee_svc_storage.c b/core/tee/tee_svc_storage.c index 2f8a53a4..a412f15d 100644 --- a/core/tee/tee_svc_storage.c +++ b/core/tee/tee_svc_storage.c @@ -240,10 +240,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, &bytes); - if (res != TEE_SUCCESS || bytes != head.attr_size) { + if (res == TEE_ERROR_OUT_OF_MEMORY) + goto exit; + if (res != TEE_SUCCESS || bytes != head.attr_size) res = TEE_ERROR_CORRUPT_OBJECT; + if (res) goto exit; - } } res = tee_obj_attr_from_binary(o, attr, head.attr_size); |