linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] tee: fix possible error pointer ctx dereferencing
@ 2019-02-20  6:02 Sumit Garg
  2019-02-22  8:09 ` Jens Wiklander
  0 siblings, 1 reply; 2+ messages in thread
From: Sumit Garg @ 2019-02-20  6:02 UTC (permalink / raw)
  To: jens.wiklander; +Cc: Sumit Garg, linux-arm-kernel, dan.carpenter, linux-kernel

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

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);
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] tee: fix possible error pointer ctx dereferencing
  2019-02-20  6:02 [PATCH -next] tee: fix possible error pointer ctx dereferencing Sumit Garg
@ 2019-02-22  8:09 ` Jens Wiklander
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Wiklander @ 2019-02-22  8:09 UTC (permalink / raw)
  To: Sumit Garg
  Cc: Arnd Bergmann, Linux ARM, Dan Carpenter, Linux Kernel Mailing List

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-22  8:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-20  6:02 [PATCH -next] tee: fix possible error pointer ctx dereferencing Sumit Garg
2019-02-22  8:09 ` Jens Wiklander

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).