linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] optee: fix the dead loop problem when there is signal pending
@ 2018-01-03 19:30 Zeng Tao
  2018-02-26 20:18 ` Jens Wiklander
  0 siblings, 1 reply; 2+ messages in thread
From: Zeng Tao @ 2018-01-03 19:30 UTC (permalink / raw)
  To: jens.wiklander; +Cc: linux-kernel, tee-dev

when the current process is doing a rpc call from optee, and if there
is a signal pending on the process, it will enter dead loop if the
tee-supplicant is working correctly, fix the problem by breaking out
the loop when the rpc job is finished.

Signed-off-by: Zeng Tao <prime.zeng@hisilicon.com>
---
 drivers/tee/optee/supp.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/tee/optee/supp.c b/drivers/tee/optee/supp.c
index b4ea067..170dedb 100644
--- a/drivers/tee/optee/supp.c
+++ b/drivers/tee/optee/supp.c
@@ -107,6 +107,13 @@ u32 optee_supp_thrd_req(struct tee_context *ctx, u32 func, size_t num_params,
 		mutex_unlock(&supp->ctx_mutex);
 		if (interruptable)
 			break;
+
+		/*
+		 * if there is signal pending, and the supplicant has finished
+		 * the rpc job, we need to break out the loop
+		 */
+		if (try_wait_for_completion(&supp->data_from_supp))
+			break;
 	}
 
 	ret = supp->ret;
-- 
2.7.4

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

* Re: [PATCH] optee: fix the dead loop problem when there is signal pending
  2018-01-03 19:30 [PATCH] optee: fix the dead loop problem when there is signal pending Zeng Tao
@ 2018-02-26 20:18 ` Jens Wiklander
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Wiklander @ 2018-02-26 20:18 UTC (permalink / raw)
  To: Zeng Tao; +Cc: Linux Kernel Mailing List, tee-dev

Hi Zeng Tao,

On Wed, Jan 3, 2018 at 8:30 PM, Zeng Tao <prime.zeng@hisilicon.com> wrote:
> when the current process is doing a rpc call from optee, and if there
> is a signal pending on the process, it will enter dead loop if the
> tee-supplicant is working correctly, fix the problem by breaking out
> the loop when the rpc job is finished.
>
> Signed-off-by: Zeng Tao <prime.zeng@hisilicon.com>
> ---
>  drivers/tee/optee/supp.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/tee/optee/supp.c b/drivers/tee/optee/supp.c
> index b4ea067..170dedb 100644
> --- a/drivers/tee/optee/supp.c
> +++ b/drivers/tee/optee/supp.c
> @@ -107,6 +107,13 @@ u32 optee_supp_thrd_req(struct tee_context *ctx, u32 func, size_t num_params,
>                 mutex_unlock(&supp->ctx_mutex);
>                 if (interruptable)
>                         break;
> +
> +               /*
> +                * if there is signal pending, and the supplicant has finished
> +                * the rpc job, we need to break out the loop
> +                */
> +               if (try_wait_for_completion(&supp->data_from_supp))
> +                       break;
>         }
>
>         ret = supp->ret;
> --
> 2.7.4
>

Since this patch was posted there has been changes (during the merge
window) to this part of the code. Please rebase, test and post again.

Thanks,
Jens

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

end of thread, other threads:[~2018-02-26 20:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-03 19:30 [PATCH] optee: fix the dead loop problem when there is signal pending Zeng Tao
2018-02-26 20:18 ` 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).