diff options
author | Sumit Garg <sumit.garg@linaro.org> | 2019-02-20 07:02:27 +0100 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2019-02-20 17:54:34 +0100 |
commit | bb342f016862a0d5b013c2a9dce0f91412b0be77 (patch) | |
tree | 2f0085afdf285d3fd7bd13d02cf832e50d51dfc6 /drivers/tee | |
parent | hwrng: optee: Initialize some structs using memset instead of braces (diff) | |
download | linux-bb342f016862a0d5b013c2a9dce0f91412b0be77.tar.xz linux-bb342f016862a0d5b013c2a9dce0f91412b0be77.zip |
tee: fix possible error pointer ctx dereferencing
Add check for valid ctx pointer and then only dereference ctx to
configure supp_nowait flag.
Fixes: 42bf4152d8a7 ("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>
Diffstat (limited to 'drivers/tee')
-rw-r--r-- | drivers/tee/tee_core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c index 25f3b9cc8908..06fbfc044ea3 100644 --- a/drivers/tee/tee_core.c +++ b/drivers/tee/tee_core.c @@ -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); |