summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/soc/qcom/hab/hab_mimex.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/soc/qcom/hab/hab_mimex.c b/drivers/soc/qcom/hab/hab_mimex.c
index 00c6c475fa92..efa4bb383ec6 100644
--- a/drivers/soc/qcom/hab/hab_mimex.c
+++ b/drivers/soc/qcom/hab/hab_mimex.c
@@ -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);