[RFC PATCH 1/3] tee: optee: Allow to freeze the task waiting for tee-supplicant

From: Christoph Gellner
Date: Wed May 26 2021 - 03:18:15 EST


When the system is going to hibernate or suspend it might happen
that the tee-supplicant task is frozen first.
wait_for_completion_interruptible might get stuck in this case.

Add try_to_freeze to allow the waiting task to be frozen while
waiting for the response of tee-supplicant.

Signed-off-by: Christoph Gellner <cgellner@xxxxxxxxxxxxxx>
---
drivers/tee/optee/supp.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/tee/optee/supp.c b/drivers/tee/optee/supp.c
index 322a543b8c27..03c37bae6ac4 100644
--- a/drivers/tee/optee/supp.c
+++ b/drivers/tee/optee/supp.c
@@ -5,6 +5,7 @@
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
+#include <linux/freezer.h>
#include "optee_private.h"

struct optee_supp_req {
@@ -141,6 +142,8 @@ u32 optee_supp_thrd_req(struct tee_context *ctx, u32 func, size_t num_params,
req->ret = TEEC_ERROR_COMMUNICATION;
break;
}
+
+ try_to_freeze();
}

ret = req->ret;
--
2.32.0.rc0