tee: fix possible error pointer ctx dereferencing

Add check for valid ctx pointer and then only dereference ctx to
configure supp_nowait flag.

Fixes: 42bf4152d8 ("tee: add supp_nowait flag in tee_context struct")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Sumit Garg 2019-02-20 11:32:27 +05:30 committed by Arnd Bergmann
parent 56410c0cb4
commit bb342f0168

View File

@ -993,7 +993,9 @@ tee_client_open_context(struct tee_context *start,
* tee_client_open_session() if any in kernel client requires
* different behaviour.
*/
ctx->supp_nowait = true;
if (!IS_ERR(ctx))
ctx->supp_nowait = true;
return ctx;
}
EXPORT_SYMBOL_GPL(tee_client_open_context);