OSDN Git Service

tee: fix possible error pointer ctx dereferencing
authorSumit Garg <sumit.garg@linaro.org>
Wed, 20 Feb 2019 06:02:27 +0000 (11:32 +0530)
committerArnd Bergmann <arnd@arndb.de>
Wed, 20 Feb 2019 16:54:34 +0000 (17:54 +0100)
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>
drivers/tee/tee_core.c

index 25f3b9c..06fbfc0 100644 (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);