linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tee: optee: add missing mutext_destroy in optee_ffa_probe
@ 2022-03-16 13:50 Dongliang Mu
  2022-03-24  8:28 ` Jens Wiklander
  0 siblings, 1 reply; 5+ messages in thread
From: Dongliang Mu @ 2022-03-16 13:50 UTC (permalink / raw)
  To: Jens Wiklander, Sumit Garg; +Cc: Dongliang Mu, op-tee, linux-kernel

From: Dongliang Mu <mudongliangabcd@gmail.com>

The error handling code of optee_ffa_probe misses the mutex_destroy of
ffa.mutex when mutext_init succeeds.

Fix this by adding mutex_destory of ffa.mutex at the error handling part

Fixes: aceeafefff73 ("optee: use driver internal tee_context for some rpc")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
---
 drivers/tee/optee/ffa_abi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c
index f744ab15bf2c..30a6119a2b16 100644
--- a/drivers/tee/optee/ffa_abi.c
+++ b/drivers/tee/optee/ffa_abi.c
@@ -894,6 +894,7 @@ static int optee_ffa_probe(struct ffa_device *ffa_dev)
 	rhashtable_free_and_destroy(&optee->ffa.global_ids, rh_free_fn, NULL);
 	optee_supp_uninit(&optee->supp);
 	mutex_destroy(&optee->call_queue.mutex);
+	mutex_destroy(&optee->ffa.mutex);
 err_unreg_supp_teedev:
 	tee_device_unregister(optee->supp_teedev);
 err_unreg_teedev:
-- 
2.25.1


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

* Re: [PATCH] tee: optee: add missing mutext_destroy in optee_ffa_probe
  2022-03-16 13:50 [PATCH] tee: optee: add missing mutext_destroy in optee_ffa_probe Dongliang Mu
@ 2022-03-24  8:28 ` Jens Wiklander
  2022-03-24  9:33   ` Dongliang Mu
  0 siblings, 1 reply; 5+ messages in thread
From: Jens Wiklander @ 2022-03-24  8:28 UTC (permalink / raw)
  To: Dongliang Mu; +Cc: Sumit Garg, Dongliang Mu, op-tee, linux-kernel

On Wed, Mar 16, 2022 at 2:51 PM Dongliang Mu <dzm91@hust.edu.cn> wrote:
>
> From: Dongliang Mu <mudongliangabcd@gmail.com>
>
> The error handling code of optee_ffa_probe misses the mutex_destroy of
> ffa.mutex when mutext_init succeeds.
>
> Fix this by adding mutex_destory of ffa.mutex at the error handling part
>
> Fixes: aceeafefff73 ("optee: use driver internal tee_context for some rpc")

I believe this should be
Fixes: 4615e5a34b95 ("optee: add FF-A support")
don't you agree?

Thanks,
Jens

> Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
> ---
>  drivers/tee/optee/ffa_abi.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c
> index f744ab15bf2c..30a6119a2b16 100644
> --- a/drivers/tee/optee/ffa_abi.c
> +++ b/drivers/tee/optee/ffa_abi.c
> @@ -894,6 +894,7 @@ static int optee_ffa_probe(struct ffa_device *ffa_dev)
>         rhashtable_free_and_destroy(&optee->ffa.global_ids, rh_free_fn, NULL);
>         optee_supp_uninit(&optee->supp);
>         mutex_destroy(&optee->call_queue.mutex);
> +       mutex_destroy(&optee->ffa.mutex);
>  err_unreg_supp_teedev:
>         tee_device_unregister(optee->supp_teedev);
>  err_unreg_teedev:
> --
> 2.25.1
>

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

* Re: [PATCH] tee: optee: add missing mutext_destroy in optee_ffa_probe
  2022-03-24  8:28 ` Jens Wiklander
@ 2022-03-24  9:33   ` Dongliang Mu
  2022-04-01  2:00     ` Dongliang Mu
  0 siblings, 1 reply; 5+ messages in thread
From: Dongliang Mu @ 2022-03-24  9:33 UTC (permalink / raw)
  To: Jens Wiklander; +Cc: Dongliang Mu, Sumit Garg, op-tee, linux-kernel

On Thu, Mar 24, 2022 at 4:29 PM Jens Wiklander
<jens.wiklander@linaro.org> wrote:
>
> On Wed, Mar 16, 2022 at 2:51 PM Dongliang Mu <dzm91@hust.edu.cn> wrote:
> >
> > From: Dongliang Mu <mudongliangabcd@gmail.com>
> >
> > The error handling code of optee_ffa_probe misses the mutex_destroy of
> > ffa.mutex when mutext_init succeeds.
> >
> > Fix this by adding mutex_destory of ffa.mutex at the error handling part
> >
> > Fixes: aceeafefff73 ("optee: use driver internal tee_context for some rpc")
>
> I believe this should be
> Fixes: 4615e5a34b95 ("optee: add FF-A support")
> don't you agree?

Hi Jen,

This commit 4615e5a34b95 is more suitable since mutex_init is introduced here.

Why did I label the commit aceeafefff73?

Because this commit tried to fix the issue, but only added one
mutex_destroy for &optee->call_queue.mutex, misses &optee->ffa.mutex.

>
> Thanks,
> Jens
>
> > Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
> > ---
> >  drivers/tee/optee/ffa_abi.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c
> > index f744ab15bf2c..30a6119a2b16 100644
> > --- a/drivers/tee/optee/ffa_abi.c
> > +++ b/drivers/tee/optee/ffa_abi.c
> > @@ -894,6 +894,7 @@ static int optee_ffa_probe(struct ffa_device *ffa_dev)
> >         rhashtable_free_and_destroy(&optee->ffa.global_ids, rh_free_fn, NULL);
> >         optee_supp_uninit(&optee->supp);
> >         mutex_destroy(&optee->call_queue.mutex);
> > +       mutex_destroy(&optee->ffa.mutex);
> >  err_unreg_supp_teedev:
> >         tee_device_unregister(optee->supp_teedev);
> >  err_unreg_teedev:
> > --
> > 2.25.1
> >

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

* Re: [PATCH] tee: optee: add missing mutext_destroy in optee_ffa_probe
  2022-03-24  9:33   ` Dongliang Mu
@ 2022-04-01  2:00     ` Dongliang Mu
  2022-04-05  7:02       ` Jens Wiklander
  0 siblings, 1 reply; 5+ messages in thread
From: Dongliang Mu @ 2022-04-01  2:00 UTC (permalink / raw)
  To: Jens Wiklander; +Cc: Dongliang Mu, Sumit Garg, op-tee, linux-kernel

On Thu, Mar 24, 2022 at 5:33 PM Dongliang Mu <mudongliangabcd@gmail.com> wrote:
>
> On Thu, Mar 24, 2022 at 4:29 PM Jens Wiklander
> <jens.wiklander@linaro.org> wrote:
> >
> > On Wed, Mar 16, 2022 at 2:51 PM Dongliang Mu <dzm91@hust.edu.cn> wrote:
> > >
> > > From: Dongliang Mu <mudongliangabcd@gmail.com>
> > >
> > > The error handling code of optee_ffa_probe misses the mutex_destroy of
> > > ffa.mutex when mutext_init succeeds.
> > >
> > > Fix this by adding mutex_destory of ffa.mutex at the error handling part
> > >
> > > Fixes: aceeafefff73 ("optee: use driver internal tee_context for some rpc")
> >
> > I believe this should be
> > Fixes: 4615e5a34b95 ("optee: add FF-A support")
> > don't you agree?
>
> Hi Jen,
>
> This commit 4615e5a34b95 is more suitable since mutex_init is introduced here.
>
> Why did I label the commit aceeafefff73?
>
> Because this commit tried to fix the issue, but only added one
> mutex_destroy for &optee->call_queue.mutex, misses &optee->ffa.mutex.
>

ping?

> >
> > Thanks,
> > Jens
> >
> > > Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
> > > ---
> > >  drivers/tee/optee/ffa_abi.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c
> > > index f744ab15bf2c..30a6119a2b16 100644
> > > --- a/drivers/tee/optee/ffa_abi.c
> > > +++ b/drivers/tee/optee/ffa_abi.c
> > > @@ -894,6 +894,7 @@ static int optee_ffa_probe(struct ffa_device *ffa_dev)
> > >         rhashtable_free_and_destroy(&optee->ffa.global_ids, rh_free_fn, NULL);
> > >         optee_supp_uninit(&optee->supp);
> > >         mutex_destroy(&optee->call_queue.mutex);
> > > +       mutex_destroy(&optee->ffa.mutex);
> > >  err_unreg_supp_teedev:
> > >         tee_device_unregister(optee->supp_teedev);
> > >  err_unreg_teedev:
> > > --
> > > 2.25.1
> > >

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

* Re: [PATCH] tee: optee: add missing mutext_destroy in optee_ffa_probe
  2022-04-01  2:00     ` Dongliang Mu
@ 2022-04-05  7:02       ` Jens Wiklander
  0 siblings, 0 replies; 5+ messages in thread
From: Jens Wiklander @ 2022-04-05  7:02 UTC (permalink / raw)
  To: Dongliang Mu; +Cc: Dongliang Mu, Sumit Garg, op-tee, linux-kernel

On Fri, Apr 1, 2022 at 4:00 AM Dongliang Mu <mudongliangabcd@gmail.com> wrote:
>
> On Thu, Mar 24, 2022 at 5:33 PM Dongliang Mu <mudongliangabcd@gmail.com> wrote:
> >
> > On Thu, Mar 24, 2022 at 4:29 PM Jens Wiklander
> > <jens.wiklander@linaro.org> wrote:
> > >
> > > On Wed, Mar 16, 2022 at 2:51 PM Dongliang Mu <dzm91@hust.edu.cn> wrote:
> > > >
> > > > From: Dongliang Mu <mudongliangabcd@gmail.com>
> > > >
> > > > The error handling code of optee_ffa_probe misses the mutex_destroy of
> > > > ffa.mutex when mutext_init succeeds.
> > > >
> > > > Fix this by adding mutex_destory of ffa.mutex at the error handling part
> > > >
> > > > Fixes: aceeafefff73 ("optee: use driver internal tee_context for some rpc")
> > >
> > > I believe this should be
> > > Fixes: 4615e5a34b95 ("optee: add FF-A support")
> > > don't you agree?
> >
> > Hi Jen,
> >
> > This commit 4615e5a34b95 is more suitable since mutex_init is introduced here.
> >
> > Why did I label the commit aceeafefff73?
> >
> > Because this commit tried to fix the issue, but only added one
> > mutex_destroy for &optee->call_queue.mutex, misses &optee->ffa.mutex.
> >
>
> ping?

I'm picking up this.

Thanks,
Jens

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

end of thread, other threads:[~2022-04-05  7:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-16 13:50 [PATCH] tee: optee: add missing mutext_destroy in optee_ffa_probe Dongliang Mu
2022-03-24  8:28 ` Jens Wiklander
2022-03-24  9:33   ` Dongliang Mu
2022-04-01  2:00     ` Dongliang Mu
2022-04-05  7:02       ` 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).