summaryrefslogtreecommitdiffstats
path: root/drivers/tee/optee
diff options
context:
space:
mode:
authorSumit Garg <sumit.garg@linaro.org>2019-01-29 11:19:36 +0530
committerJens Wiklander <jens.wiklander@linaro.org>2019-02-01 15:12:46 +0100
commit42bf4152d8a79f89f5456dee63a1f364fbce2dd6 (patch)
tree4f89fc2690e28b92610cfc5f7a9a31beb481c2e6 /drivers/tee/optee
parent49a57857aeea06ca831043acbb0fa5e0f50602fd (diff)
downloadlinux-42bf4152d8a79f89f5456dee63a1f364fbce2dd6.tar.bz2
tee: add supp_nowait flag in tee_context struct
This flag indicates that requests in this context should not wait for tee-supplicant daemon to be started if not present and just return with an error code. It is needed for requests which should be non-blocking in nature like ones arising from TEE based kernel drivers or any in kernel api that uses TEE internal client interface. Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'drivers/tee/optee')
-rw-r--r--drivers/tee/optee/supp.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/tee/optee/supp.c b/drivers/tee/optee/supp.c
index 43626e15703a..92f56b8645e3 100644
--- a/drivers/tee/optee/supp.c
+++ b/drivers/tee/optee/supp.c
@@ -88,10 +88,18 @@ u32 optee_supp_thrd_req(struct tee_context *ctx, u32 func, size_t num_params,
{
struct optee *optee = tee_get_drvdata(ctx->teedev);
struct optee_supp *supp = &optee->supp;
- struct optee_supp_req *req = kzalloc(sizeof(*req), GFP_KERNEL);
+ struct optee_supp_req *req;
bool interruptable;
u32 ret;
+ /*
+ * Return in case there is no supplicant available and
+ * non-blocking request.
+ */
+ if (!supp->ctx && ctx->supp_nowait)
+ return TEEC_ERROR_COMMUNICATION;
+
+ req = kzalloc(sizeof(*req), GFP_KERNEL);
if (!req)
return TEEC_ERROR_OUT_OF_MEMORY;