Skip to content

Commit d4fac25

Browse files
Yang Yingliangjenswi-linaro
authored andcommitted
optee: smc_abi.c: fix wrong pointer passed to IS_ERR/PTR_ERR()
In optee_smc_do_call_with_arg() there is a code path when the argument struct for RPC is passed appended to the primary argument struct. When the address of the RPC struct is retrieved there's an invalid check for success. It should be 'rpc_arg' pass to IS_ERR/PTR_ERR(). Fixes: ed8faf6 ("optee: add OPTEE_SMC_CALL_WITH_RPC_ARG and OPTEE_SMC_CALL_WITH_REGD_ARG") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> [jw: added background to the problem] Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
1 parent b13bacc commit d4fac25

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/tee/optee/smc_abi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,8 +884,8 @@ static int optee_smc_do_call_with_arg(struct tee_context *ctx,
884884

885885
rpc_arg_offs = OPTEE_MSG_GET_ARG_SIZE(arg->num_params);
886886
rpc_arg = tee_shm_get_va(shm, offs + rpc_arg_offs);
887-
if (IS_ERR(arg))
888-
return PTR_ERR(arg);
887+
if (IS_ERR(rpc_arg))
888+
return PTR_ERR(rpc_arg);
889889
}
890890

891891
if (rpc_arg && tee_shm_is_dynamic(shm)) {

0 commit comments

Comments
 (0)