Skip to content

Commit f62df16

Browse files
etienne-lmssmb49
authored andcommitted
optee: fix uninited async notif value
BugLink: https://bugs.launchpad.net/bugs/2028979 commit 654d031 upstream. Fixes an uninitialized variable in irq_handler() that could lead to unpredictable behavior in case OP-TEE fails to handle SMC function ID OPTEE_SMC_GET_ASYNC_NOTIF_VALUE. This change ensures that in that case get_async_notif_value() properly reports there are no notification event. Reported-by: kernel test robot <[email protected]> Link: https://lore.kernel.org/r/[email protected]/ Reported-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/all/[email protected]/ Fixes: 6749e69 ("optee: add asynchronous notifications") Signed-off-by: Etienne Carriere <[email protected]> Reviewed-by: Sumit Garg <[email protected]> Signed-off-by: Jens Wiklander <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Kamal Mostafa <[email protected]> Signed-off-by: Stefan Bader <[email protected]>
1 parent a0921fc commit f62df16

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/tee/optee/smc_abi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,8 +984,10 @@ static u32 get_async_notif_value(optee_invoke_fn *invoke_fn, bool *value_valid,
984984

985985
invoke_fn(OPTEE_SMC_GET_ASYNC_NOTIF_VALUE, 0, 0, 0, 0, 0, 0, 0, &res);
986986

987-
if (res.a0)
987+
if (res.a0) {
988+
*value_valid = false;
988989
return 0;
990+
}
989991
*value_valid = (res.a2 & OPTEE_SMC_ASYNC_NOTIF_VALUE_VALID);
990992
*value_pending = (res.a2 & OPTEE_SMC_ASYNC_NOTIF_VALUE_PENDING);
991993
return res.a1;

0 commit comments

Comments
 (0)