[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFA6WYPZ-JbAhfvdWfbcgqBRnA9F-=o5k=ZzR_KYL+rAkVm3PA@mail.gmail.com>
Date: Wed, 13 Oct 2021 12:39:02 +0530
From: Sumit Garg <sumit.garg@...aro.org>
To: Jens Wiklander <jens.wiklander@...aro.org>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
OP-TEE TrustedFirmware <op-tee@...ts.trustedfirmware.org>,
Devicetree List <devicetree@...r.kernel.org>,
Linux Doc Mailing List <linux-doc@...r.kernel.org>,
Jerome Forissier <jerome@...issier.org>,
Etienne Carriere <etienne.carriere@...aro.org>,
Vincent Guittot <vincent.guittot@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
Jonathan Corbet <corbet@....net>,
Ard Biesheuvel <ardb@...nel.org>, Marc Zyngier <maz@...nel.org>
Subject: Re: [PATCH v6 3/6] tee: fix put order in teedev_close_context()
On Wed, 6 Oct 2021 at 12:45, Jens Wiklander <jens.wiklander@...aro.org> wrote:
>
> Prior to this patch was teedev_close_context() calling tee_device_put()
> before teedev_ctx_put() leading to teedev_ctx_release() accessing
> ctx->teedev just after the reference counter was decreased on the
> teedev. Fix this by calling teedev_ctx_put() before tee_device_put().
>
> Fixes: 217e0250cccb ("tee: use reference counting for tee_context")
> Signed-off-by: Jens Wiklander <jens.wiklander@...aro.org>
> ---
> drivers/tee/tee_core.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
Reviewed-by: Sumit Garg <sumit.garg@...aro.org>
-Sumit
> diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
> index 2b37bc408fc3..85102d12d716 100644
> --- a/drivers/tee/tee_core.c
> +++ b/drivers/tee/tee_core.c
> @@ -98,8 +98,10 @@ void teedev_ctx_put(struct tee_context *ctx)
>
> static void teedev_close_context(struct tee_context *ctx)
> {
> - tee_device_put(ctx->teedev);
> + struct tee_device *teedev = ctx->teedev;
> +
> teedev_ctx_put(ctx);
> + tee_device_put(teedev);
> }
>
> static int tee_open(struct inode *inode, struct file *filp)
> --
> 2.31.1
>
Powered by blists - more mailing lists