Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: fix OOM handling in tee_svc_storage_read_head() #2316

Merged
merged 1 commit into from
May 14, 2018

Conversation

jenswi-linaro
Copy link
Contributor

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.

Signed-off-by: Jens Wiklander jens.wiklander@linaro.org

Fixes #2310

if (res == TEE_ERROR_OUT_OF_MEMORY)
goto exit;
if (bytes != head.attr_size)
res = TEE_ERROR_CORRUPT_OBJECT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be:

	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;

@@ -214,6 +214,8 @@ static TEE_Result tee_svc_storage_read_head(struct tee_obj *o)
bytes = sizeof(struct tee_svc_storage_head);
res = fops->read(o->fh, 0, &head, &bytes);
if (res != TEE_SUCCESS) {
if (res == TEE_ERROR_OUT_OF_MEMORY)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed.

@jenswi-linaro
Copy link
Contributor Author

Updated

@etienne-lms
Copy link
Contributor

Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>

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>
@jenswi-linaro
Copy link
Contributor Author

Tag applied

@jforissier jforissier merged commit f678d2c into OP-TEE:master May 14, 2018
@jenswi-linaro jenswi-linaro deleted the fix_storage branch May 14, 2018 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants