diff mbox series

[-next] tee: fix possible error pointer ctx dereferencing

Message ID 1550642547-21968-1-git-send-email-sumit.garg@linaro.org
State Accepted
Commit bb342f016862a0d5b013c2a9dce0f91412b0be77
Headers show
Series [-next] tee: fix possible error pointer ctx dereferencing | expand

Commit Message

Sumit Garg Feb. 20, 2019, 6:02 a.m. UTC
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>

---
 drivers/tee/tee_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.7.4

Comments

Jens Wiklander Feb. 22, 2019, 8:09 a.m. UTC | #1
Hi,

On Wed, Feb 20, 2019 at 7:02 AM Sumit Garg <sumit.garg@linaro.org> wrote:
>

> 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>

> ---

>  drivers/tee/tee_core.c | 4 +++-

>  1 file changed, 3 insertions(+), 1 deletion(-)


I see that Arnd picked this one up the arm/drivers branch too. Thanks
for the help Arnd!

Cheers,
Jens
diff mbox series

Patch

diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
index 25f3b9c..06fbfc0 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);