From 5e81752350d68e366bdc804201e27d15a8f3f0cf Mon Sep 17 00:00:00 2001 From: Jens Wiklander Date: Thu, 13 Aug 2020 16:42:17 +0200 Subject: core: syscall_storage_obj_create(): check that the attributes object is initialized Adds a check in syscall_storage_obj_create() to see that the attributes object is initialized. Reviewed-by: Jerome Forissier Signed-off-by: Jens Wiklander --- core/tee/tee_svc_storage.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'core/tee') diff --git a/core/tee/tee_svc_storage.c b/core/tee/tee_svc_storage.c index 5602504a..d6418ec5 100644 --- a/core/tee/tee_svc_storage.c +++ b/core/tee/tee_svc_storage.c @@ -463,6 +463,11 @@ TEE_Result syscall_storage_obj_create(unsigned long storage_id, void *object_id, &attr_o); if (res != TEE_SUCCESS) goto err; + /* The supplied handle must be one of an initialized object */ + if (!(attr_o->info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED)) { + res = TEE_ERROR_BAD_PARAMETERS; + goto err; + } } res = tee_svc_storage_init_file(o, attr_o, data, len); -- cgit v1.2.3