Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1eaf1fb7 authored by Yajun Li's avatar Yajun Li
Browse files

soc: hab: add size checking when hab import buffer



If the input size of import buffer isn't equal to
the real size of this buffer, hab should reject this
import function.

Change-Id: I184a0752d37e9f1bf6a8705ccf8f2fdfd6796d5e
Signed-off-by: default avatarYajun Li <yajunl@codeaurora.org>
parent 51abefff
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -376,6 +376,13 @@ int hab_mem_import(struct uhab_context *ctx,
	}
	spin_unlock_bh(&ctx->imp_lock);

	if ((exp->payload_count << PAGE_SHIFT) != param->sizebytes) {
		pr_err("input size %d don't match buffer size %d\n",
			param->sizebytes, exp->payload_count << PAGE_SHIFT);
		ret = -EINVAL;
		goto err_imp;
	}

	if (!found) {
		pr_err("Fail to get export descriptor from export id %d\n",
			param->exportid);