All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tee: optee: Fix missing devices unregister during optee_remove
@ 2021-10-12  7:31 ` Sumit Garg
  0 siblings, 0 replies; 14+ messages in thread
From: Sumit Garg @ 2021-10-12  7:31 UTC (permalink / raw)
  To: op-tee
  Cc: jens.wiklander, sudeep.holla, jerome, daniel.thompson,
	maxim.uvarov, linux-arm-kernel, linux-kernel, Sumit Garg

When OP-TEE driver is built as a module, OP-TEE client devices
registered on TEE bus during probe should be unregistered during
optee_remove. So implement optee_unregister_devices() accordingly.

Fixes: c3fa24af9244 ("tee: optee: add TEE bus device enumeration support")
Reported-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
---
 drivers/tee/optee/core.c          |  3 +++
 drivers/tee/optee/device.c        | 22 ++++++++++++++++++++++
 drivers/tee/optee/optee_private.h |  1 +
 3 files changed, 26 insertions(+)

diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index ccad3c7c8f6d..3915dc574503 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -586,6 +586,9 @@ static int optee_remove(struct platform_device *pdev)
 {
 	struct optee *optee = platform_get_drvdata(pdev);
 
+	/* Unregister OP-TEE specific client devices on TEE bus */
+	optee_unregister_devices();
+
 	/*
 	 * Ask OP-TEE to free all cached shared memory objects to decrease
 	 * reference counters and also avoid wild pointers in secure world
diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c
index ec1d24693eba..128a2d2a50a1 100644
--- a/drivers/tee/optee/device.c
+++ b/drivers/tee/optee/device.c
@@ -53,6 +53,13 @@ static int get_devices(struct tee_context *ctx, u32 session,
 	return 0;
 }
 
+static void optee_release_device(struct device *dev)
+{
+	struct tee_client_device *optee_device = to_tee_client_device(dev);
+
+	kfree(optee_device);
+}
+
 static int optee_register_device(const uuid_t *device_uuid)
 {
 	struct tee_client_device *optee_device = NULL;
@@ -63,6 +70,7 @@ static int optee_register_device(const uuid_t *device_uuid)
 		return -ENOMEM;
 
 	optee_device->dev.bus = &tee_bus_type;
+	optee_device->dev.release = optee_release_device;
 	if (dev_set_name(&optee_device->dev, "optee-ta-%pUb", device_uuid)) {
 		kfree(optee_device);
 		return -ENOMEM;
@@ -154,3 +162,17 @@ int optee_enumerate_devices(u32 func)
 {
 	return  __optee_enumerate_devices(func);
 }
+
+static int __optee_unregister_device(struct device *dev, void *data)
+{
+	if (!strncmp(dev_name(dev), "optee-ta", strlen("optee-ta")))
+		device_unregister(dev);
+
+	return 0;
+}
+
+void optee_unregister_devices(void)
+{
+	bus_for_each_dev(&tee_bus_type, NULL, NULL,
+			 __optee_unregister_device);
+}
diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h
index e25b216a14ef..39be9aa7bd22 100644
--- a/drivers/tee/optee/optee_private.h
+++ b/drivers/tee/optee/optee_private.h
@@ -183,6 +183,7 @@ void optee_fill_pages_list(u64 *dst, struct page **pages, int num_pages,
 #define PTA_CMD_GET_DEVICES		0x0
 #define PTA_CMD_GET_DEVICES_SUPP	0x1
 int optee_enumerate_devices(u32 func);
+void optee_unregister_devices(void);
 
 /*
  * Small helpers
-- 
2.25.1


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

* [PATCH] tee: optee: Fix missing devices unregister during optee_remove
@ 2021-10-12  7:31 ` Sumit Garg
  0 siblings, 0 replies; 14+ messages in thread
From: Sumit Garg @ 2021-10-12  7:31 UTC (permalink / raw)
  To: op-tee
  Cc: jens.wiklander, sudeep.holla, jerome, daniel.thompson,
	maxim.uvarov, linux-arm-kernel, linux-kernel, Sumit Garg

When OP-TEE driver is built as a module, OP-TEE client devices
registered on TEE bus during probe should be unregistered during
optee_remove. So implement optee_unregister_devices() accordingly.

Fixes: c3fa24af9244 ("tee: optee: add TEE bus device enumeration support")
Reported-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
---
 drivers/tee/optee/core.c          |  3 +++
 drivers/tee/optee/device.c        | 22 ++++++++++++++++++++++
 drivers/tee/optee/optee_private.h |  1 +
 3 files changed, 26 insertions(+)

diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index ccad3c7c8f6d..3915dc574503 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -586,6 +586,9 @@ static int optee_remove(struct platform_device *pdev)
 {
 	struct optee *optee = platform_get_drvdata(pdev);
 
+	/* Unregister OP-TEE specific client devices on TEE bus */
+	optee_unregister_devices();
+
 	/*
 	 * Ask OP-TEE to free all cached shared memory objects to decrease
 	 * reference counters and also avoid wild pointers in secure world
diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c
index ec1d24693eba..128a2d2a50a1 100644
--- a/drivers/tee/optee/device.c
+++ b/drivers/tee/optee/device.c
@@ -53,6 +53,13 @@ static int get_devices(struct tee_context *ctx, u32 session,
 	return 0;
 }
 
+static void optee_release_device(struct device *dev)
+{
+	struct tee_client_device *optee_device = to_tee_client_device(dev);
+
+	kfree(optee_device);
+}
+
 static int optee_register_device(const uuid_t *device_uuid)
 {
 	struct tee_client_device *optee_device = NULL;
@@ -63,6 +70,7 @@ static int optee_register_device(const uuid_t *device_uuid)
 		return -ENOMEM;
 
 	optee_device->dev.bus = &tee_bus_type;
+	optee_device->dev.release = optee_release_device;
 	if (dev_set_name(&optee_device->dev, "optee-ta-%pUb", device_uuid)) {
 		kfree(optee_device);
 		return -ENOMEM;
@@ -154,3 +162,17 @@ int optee_enumerate_devices(u32 func)
 {
 	return  __optee_enumerate_devices(func);
 }
+
+static int __optee_unregister_device(struct device *dev, void *data)
+{
+	if (!strncmp(dev_name(dev), "optee-ta", strlen("optee-ta")))
+		device_unregister(dev);
+
+	return 0;
+}
+
+void optee_unregister_devices(void)
+{
+	bus_for_each_dev(&tee_bus_type, NULL, NULL,
+			 __optee_unregister_device);
+}
diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h
index e25b216a14ef..39be9aa7bd22 100644
--- a/drivers/tee/optee/optee_private.h
+++ b/drivers/tee/optee/optee_private.h
@@ -183,6 +183,7 @@ void optee_fill_pages_list(u64 *dst, struct page **pages, int num_pages,
 #define PTA_CMD_GET_DEVICES		0x0
 #define PTA_CMD_GET_DEVICES_SUPP	0x1
 int optee_enumerate_devices(u32 func);
+void optee_unregister_devices(void);
 
 /*
  * Small helpers
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] tee: optee: Fix missing devices unregister during optee_remove
  2021-10-12  7:31 ` Sumit Garg
@ 2021-10-12  7:59   ` Jens Wiklander
  -1 siblings, 0 replies; 14+ messages in thread
From: Jens Wiklander @ 2021-10-12  7:59 UTC (permalink / raw)
  To: Sumit Garg
  Cc: OP-TEE TrustedFirmware, Sudeep Holla, Jerome Forissier,
	Daniel Thompson, Maxim Uvarov, Linux ARM,
	Linux Kernel Mailing List

Hi Sumit,

On Tue, Oct 12, 2021 at 9:31 AM Sumit Garg <sumit.garg@linaro.org> wrote:
>
> When OP-TEE driver is built as a module, OP-TEE client devices
> registered on TEE bus during probe should be unregistered during
> optee_remove. So implement optee_unregister_devices() accordingly.
>
> Fixes: c3fa24af9244 ("tee: optee: add TEE bus device enumeration support")
> Reported-by: Sudeep Holla <sudeep.holla@arm.com>
> Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> ---
>  drivers/tee/optee/core.c          |  3 +++
>  drivers/tee/optee/device.c        | 22 ++++++++++++++++++++++
>  drivers/tee/optee/optee_private.h |  1 +
>  3 files changed, 26 insertions(+)
>
> diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> index ccad3c7c8f6d..3915dc574503 100644
> --- a/drivers/tee/optee/core.c
> +++ b/drivers/tee/optee/core.c
> @@ -586,6 +586,9 @@ static int optee_remove(struct platform_device *pdev)
>  {
>         struct optee *optee = platform_get_drvdata(pdev);
>
> +       /* Unregister OP-TEE specific client devices on TEE bus */
> +       optee_unregister_devices();
> +
>         /*
>          * Ask OP-TEE to free all cached shared memory objects to decrease
>          * reference counters and also avoid wild pointers in secure world
> diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c
> index ec1d24693eba..128a2d2a50a1 100644
> --- a/drivers/tee/optee/device.c
> +++ b/drivers/tee/optee/device.c
> @@ -53,6 +53,13 @@ static int get_devices(struct tee_context *ctx, u32 session,
>         return 0;
>  }
>
> +static void optee_release_device(struct device *dev)
> +{
> +       struct tee_client_device *optee_device = to_tee_client_device(dev);
> +
> +       kfree(optee_device);
> +}
> +
>  static int optee_register_device(const uuid_t *device_uuid)
>  {
>         struct tee_client_device *optee_device = NULL;
> @@ -63,6 +70,7 @@ static int optee_register_device(const uuid_t *device_uuid)
>                 return -ENOMEM;
>
>         optee_device->dev.bus = &tee_bus_type;
> +       optee_device->dev.release = optee_release_device;
>         if (dev_set_name(&optee_device->dev, "optee-ta-%pUb", device_uuid)) {
>                 kfree(optee_device);
>                 return -ENOMEM;
> @@ -154,3 +162,17 @@ int optee_enumerate_devices(u32 func)
>  {
>         return  __optee_enumerate_devices(func);
>  }
> +
> +static int __optee_unregister_device(struct device *dev, void *data)
> +{
> +       if (!strncmp(dev_name(dev), "optee-ta", strlen("optee-ta")))
> +               device_unregister(dev);
> +
> +       return 0;
> +}
> +
> +void optee_unregister_devices(void)
> +{
> +       bus_for_each_dev(&tee_bus_type, NULL, NULL,
> +                        __optee_unregister_device);

I had something like this in mind too, but there's one potential
problem with this approach. What if there's more than one OP-TEE
driver with TAs here? It seems that we'll remove TAs from other
drivers too then.

This is not likely to be a problem at upstream for the moment so I
might be enough just to keep this in mind if/when the OP-TEE driver is
extended in a way that there can be multiple OP-TEEs handled.

Cheers,
Jens

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

* Re: [PATCH] tee: optee: Fix missing devices unregister during optee_remove
@ 2021-10-12  7:59   ` Jens Wiklander
  0 siblings, 0 replies; 14+ messages in thread
From: Jens Wiklander @ 2021-10-12  7:59 UTC (permalink / raw)
  To: Sumit Garg
  Cc: OP-TEE TrustedFirmware, Sudeep Holla, Jerome Forissier,
	Daniel Thompson, Maxim Uvarov, Linux ARM,
	Linux Kernel Mailing List

Hi Sumit,

On Tue, Oct 12, 2021 at 9:31 AM Sumit Garg <sumit.garg@linaro.org> wrote:
>
> When OP-TEE driver is built as a module, OP-TEE client devices
> registered on TEE bus during probe should be unregistered during
> optee_remove. So implement optee_unregister_devices() accordingly.
>
> Fixes: c3fa24af9244 ("tee: optee: add TEE bus device enumeration support")
> Reported-by: Sudeep Holla <sudeep.holla@arm.com>
> Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> ---
>  drivers/tee/optee/core.c          |  3 +++
>  drivers/tee/optee/device.c        | 22 ++++++++++++++++++++++
>  drivers/tee/optee/optee_private.h |  1 +
>  3 files changed, 26 insertions(+)
>
> diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> index ccad3c7c8f6d..3915dc574503 100644
> --- a/drivers/tee/optee/core.c
> +++ b/drivers/tee/optee/core.c
> @@ -586,6 +586,9 @@ static int optee_remove(struct platform_device *pdev)
>  {
>         struct optee *optee = platform_get_drvdata(pdev);
>
> +       /* Unregister OP-TEE specific client devices on TEE bus */
> +       optee_unregister_devices();
> +
>         /*
>          * Ask OP-TEE to free all cached shared memory objects to decrease
>          * reference counters and also avoid wild pointers in secure world
> diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c
> index ec1d24693eba..128a2d2a50a1 100644
> --- a/drivers/tee/optee/device.c
> +++ b/drivers/tee/optee/device.c
> @@ -53,6 +53,13 @@ static int get_devices(struct tee_context *ctx, u32 session,
>         return 0;
>  }
>
> +static void optee_release_device(struct device *dev)
> +{
> +       struct tee_client_device *optee_device = to_tee_client_device(dev);
> +
> +       kfree(optee_device);
> +}
> +
>  static int optee_register_device(const uuid_t *device_uuid)
>  {
>         struct tee_client_device *optee_device = NULL;
> @@ -63,6 +70,7 @@ static int optee_register_device(const uuid_t *device_uuid)
>                 return -ENOMEM;
>
>         optee_device->dev.bus = &tee_bus_type;
> +       optee_device->dev.release = optee_release_device;
>         if (dev_set_name(&optee_device->dev, "optee-ta-%pUb", device_uuid)) {
>                 kfree(optee_device);
>                 return -ENOMEM;
> @@ -154,3 +162,17 @@ int optee_enumerate_devices(u32 func)
>  {
>         return  __optee_enumerate_devices(func);
>  }
> +
> +static int __optee_unregister_device(struct device *dev, void *data)
> +{
> +       if (!strncmp(dev_name(dev), "optee-ta", strlen("optee-ta")))
> +               device_unregister(dev);
> +
> +       return 0;
> +}
> +
> +void optee_unregister_devices(void)
> +{
> +       bus_for_each_dev(&tee_bus_type, NULL, NULL,
> +                        __optee_unregister_device);

I had something like this in mind too, but there's one potential
problem with this approach. What if there's more than one OP-TEE
driver with TAs here? It seems that we'll remove TAs from other
drivers too then.

This is not likely to be a problem at upstream for the moment so I
might be enough just to keep this in mind if/when the OP-TEE driver is
extended in a way that there can be multiple OP-TEEs handled.

Cheers,
Jens

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] tee: optee: Fix missing devices unregister during optee_remove
  2021-10-12  7:59   ` Jens Wiklander
@ 2021-10-12  8:27     ` Sumit Garg
  -1 siblings, 0 replies; 14+ messages in thread
From: Sumit Garg @ 2021-10-12  8:27 UTC (permalink / raw)
  To: Jens Wiklander
  Cc: OP-TEE TrustedFirmware, Sudeep Holla, Jerome Forissier,
	Daniel Thompson, Maxim Uvarov, Linux ARM,
	Linux Kernel Mailing List

Hi Jens,

On Tue, 12 Oct 2021 at 13:29, Jens Wiklander <jens.wiklander@linaro.org> wrote:
>
> Hi Sumit,
>
> On Tue, Oct 12, 2021 at 9:31 AM Sumit Garg <sumit.garg@linaro.org> wrote:
> >
> > When OP-TEE driver is built as a module, OP-TEE client devices
> > registered on TEE bus during probe should be unregistered during
> > optee_remove. So implement optee_unregister_devices() accordingly.
> >
> > Fixes: c3fa24af9244 ("tee: optee: add TEE bus device enumeration support")
> > Reported-by: Sudeep Holla <sudeep.holla@arm.com>
> > Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> > ---
> >  drivers/tee/optee/core.c          |  3 +++
> >  drivers/tee/optee/device.c        | 22 ++++++++++++++++++++++
> >  drivers/tee/optee/optee_private.h |  1 +
> >  3 files changed, 26 insertions(+)
> >
> > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> > index ccad3c7c8f6d..3915dc574503 100644
> > --- a/drivers/tee/optee/core.c
> > +++ b/drivers/tee/optee/core.c
> > @@ -586,6 +586,9 @@ static int optee_remove(struct platform_device *pdev)
> >  {
> >         struct optee *optee = platform_get_drvdata(pdev);
> >
> > +       /* Unregister OP-TEE specific client devices on TEE bus */
> > +       optee_unregister_devices();
> > +
> >         /*
> >          * Ask OP-TEE to free all cached shared memory objects to decrease
> >          * reference counters and also avoid wild pointers in secure world
> > diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c
> > index ec1d24693eba..128a2d2a50a1 100644
> > --- a/drivers/tee/optee/device.c
> > +++ b/drivers/tee/optee/device.c
> > @@ -53,6 +53,13 @@ static int get_devices(struct tee_context *ctx, u32 session,
> >         return 0;
> >  }
> >
> > +static void optee_release_device(struct device *dev)
> > +{
> > +       struct tee_client_device *optee_device = to_tee_client_device(dev);
> > +
> > +       kfree(optee_device);
> > +}
> > +
> >  static int optee_register_device(const uuid_t *device_uuid)
> >  {
> >         struct tee_client_device *optee_device = NULL;
> > @@ -63,6 +70,7 @@ static int optee_register_device(const uuid_t *device_uuid)
> >                 return -ENOMEM;
> >
> >         optee_device->dev.bus = &tee_bus_type;
> > +       optee_device->dev.release = optee_release_device;
> >         if (dev_set_name(&optee_device->dev, "optee-ta-%pUb", device_uuid)) {
> >                 kfree(optee_device);
> >                 return -ENOMEM;
> > @@ -154,3 +162,17 @@ int optee_enumerate_devices(u32 func)
> >  {
> >         return  __optee_enumerate_devices(func);
> >  }
> > +
> > +static int __optee_unregister_device(struct device *dev, void *data)
> > +{
> > +       if (!strncmp(dev_name(dev), "optee-ta", strlen("optee-ta")))

The issue you described below should be handled by this check as we
would register TAs with unique name corresponding to each OP-TEE
driver.

> > +               device_unregister(dev);
> > +
> > +       return 0;
> > +}
> > +
> > +void optee_unregister_devices(void)
> > +{
> > +       bus_for_each_dev(&tee_bus_type, NULL, NULL,
> > +                        __optee_unregister_device);
>
> I had something like this in mind too, but there's one potential
> problem with this approach. What if there's more than one OP-TEE
> driver with TAs here? It seems that we'll remove TAs from other
> drivers too then.

We should be able to easily differentiate among TAs associated with
any of multiple OP-TEE drivers based on their unique device name.

>
> This is not likely to be a problem at upstream for the moment so I
> might be enough just to keep this in mind if/when the OP-TEE driver is
> extended in a way that there can be multiple OP-TEEs handled.
>

Given above comments, I think it should be easily handled.

-Sumit

> Cheers,
> Jens

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

* Re: [PATCH] tee: optee: Fix missing devices unregister during optee_remove
@ 2021-10-12  8:27     ` Sumit Garg
  0 siblings, 0 replies; 14+ messages in thread
From: Sumit Garg @ 2021-10-12  8:27 UTC (permalink / raw)
  To: Jens Wiklander
  Cc: OP-TEE TrustedFirmware, Sudeep Holla, Jerome Forissier,
	Daniel Thompson, Maxim Uvarov, Linux ARM,
	Linux Kernel Mailing List

Hi Jens,

On Tue, 12 Oct 2021 at 13:29, Jens Wiklander <jens.wiklander@linaro.org> wrote:
>
> Hi Sumit,
>
> On Tue, Oct 12, 2021 at 9:31 AM Sumit Garg <sumit.garg@linaro.org> wrote:
> >
> > When OP-TEE driver is built as a module, OP-TEE client devices
> > registered on TEE bus during probe should be unregistered during
> > optee_remove. So implement optee_unregister_devices() accordingly.
> >
> > Fixes: c3fa24af9244 ("tee: optee: add TEE bus device enumeration support")
> > Reported-by: Sudeep Holla <sudeep.holla@arm.com>
> > Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> > ---
> >  drivers/tee/optee/core.c          |  3 +++
> >  drivers/tee/optee/device.c        | 22 ++++++++++++++++++++++
> >  drivers/tee/optee/optee_private.h |  1 +
> >  3 files changed, 26 insertions(+)
> >
> > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> > index ccad3c7c8f6d..3915dc574503 100644
> > --- a/drivers/tee/optee/core.c
> > +++ b/drivers/tee/optee/core.c
> > @@ -586,6 +586,9 @@ static int optee_remove(struct platform_device *pdev)
> >  {
> >         struct optee *optee = platform_get_drvdata(pdev);
> >
> > +       /* Unregister OP-TEE specific client devices on TEE bus */
> > +       optee_unregister_devices();
> > +
> >         /*
> >          * Ask OP-TEE to free all cached shared memory objects to decrease
> >          * reference counters and also avoid wild pointers in secure world
> > diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c
> > index ec1d24693eba..128a2d2a50a1 100644
> > --- a/drivers/tee/optee/device.c
> > +++ b/drivers/tee/optee/device.c
> > @@ -53,6 +53,13 @@ static int get_devices(struct tee_context *ctx, u32 session,
> >         return 0;
> >  }
> >
> > +static void optee_release_device(struct device *dev)
> > +{
> > +       struct tee_client_device *optee_device = to_tee_client_device(dev);
> > +
> > +       kfree(optee_device);
> > +}
> > +
> >  static int optee_register_device(const uuid_t *device_uuid)
> >  {
> >         struct tee_client_device *optee_device = NULL;
> > @@ -63,6 +70,7 @@ static int optee_register_device(const uuid_t *device_uuid)
> >                 return -ENOMEM;
> >
> >         optee_device->dev.bus = &tee_bus_type;
> > +       optee_device->dev.release = optee_release_device;
> >         if (dev_set_name(&optee_device->dev, "optee-ta-%pUb", device_uuid)) {
> >                 kfree(optee_device);
> >                 return -ENOMEM;
> > @@ -154,3 +162,17 @@ int optee_enumerate_devices(u32 func)
> >  {
> >         return  __optee_enumerate_devices(func);
> >  }
> > +
> > +static int __optee_unregister_device(struct device *dev, void *data)
> > +{
> > +       if (!strncmp(dev_name(dev), "optee-ta", strlen("optee-ta")))

The issue you described below should be handled by this check as we
would register TAs with unique name corresponding to each OP-TEE
driver.

> > +               device_unregister(dev);
> > +
> > +       return 0;
> > +}
> > +
> > +void optee_unregister_devices(void)
> > +{
> > +       bus_for_each_dev(&tee_bus_type, NULL, NULL,
> > +                        __optee_unregister_device);
>
> I had something like this in mind too, but there's one potential
> problem with this approach. What if there's more than one OP-TEE
> driver with TAs here? It seems that we'll remove TAs from other
> drivers too then.

We should be able to easily differentiate among TAs associated with
any of multiple OP-TEE drivers based on their unique device name.

>
> This is not likely to be a problem at upstream for the moment so I
> might be enough just to keep this in mind if/when the OP-TEE driver is
> extended in a way that there can be multiple OP-TEEs handled.
>

Given above comments, I think it should be easily handled.

-Sumit

> Cheers,
> Jens

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] tee: optee: Fix missing devices unregister during optee_remove
  2021-10-12  7:31 ` Sumit Garg
@ 2021-10-12 18:03   ` Sudeep Holla
  -1 siblings, 0 replies; 14+ messages in thread
From: Sudeep Holla @ 2021-10-12 18:03 UTC (permalink / raw)
  To: Sumit Garg
  Cc: op-tee, jens.wiklander, jerome, daniel.thompson, maxim.uvarov,
	linux-arm-kernel, Sudeep Holla, linux-kernel

On Tue, Oct 12, 2021 at 01:01:16PM +0530, Sumit Garg wrote:
> When OP-TEE driver is built as a module, OP-TEE client devices
> registered on TEE bus during probe should be unregistered during
> optee_remove. So implement optee_unregister_devices() accordingly.
> 
> Fixes: c3fa24af9244 ("tee: optee: add TEE bus device enumeration support")
> Reported-by: Sudeep Holla <sudeep.holla@arm.com>
> Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> ---
>  drivers/tee/optee/core.c          |  3 +++
>  drivers/tee/optee/device.c        | 22 ++++++++++++++++++++++
>  drivers/tee/optee/optee_private.h |  1 +
>  3 files changed, 26 insertions(+)
> 
> diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> index ccad3c7c8f6d..3915dc574503 100644
> --- a/drivers/tee/optee/core.c
> +++ b/drivers/tee/optee/core.c
> @@ -586,6 +586,9 @@ static int optee_remove(struct platform_device *pdev)
>  {
>  	struct optee *optee = platform_get_drvdata(pdev);
>  
> +	/* Unregister OP-TEE specific client devices on TEE bus */
> +	optee_unregister_devices();
> +

This is not based on FF-A support series by Jens I assume. I added
optee_unregister_devices to optee_remove_common and that fixes the issue
I reported. I haven't followed the comments by Jens on the approach yet.

-- 
Regards,
Sudeep

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

* Re: [PATCH] tee: optee: Fix missing devices unregister during optee_remove
@ 2021-10-12 18:03   ` Sudeep Holla
  0 siblings, 0 replies; 14+ messages in thread
From: Sudeep Holla @ 2021-10-12 18:03 UTC (permalink / raw)
  To: Sumit Garg
  Cc: op-tee, jens.wiklander, jerome, daniel.thompson, maxim.uvarov,
	linux-arm-kernel, Sudeep Holla, linux-kernel

On Tue, Oct 12, 2021 at 01:01:16PM +0530, Sumit Garg wrote:
> When OP-TEE driver is built as a module, OP-TEE client devices
> registered on TEE bus during probe should be unregistered during
> optee_remove. So implement optee_unregister_devices() accordingly.
> 
> Fixes: c3fa24af9244 ("tee: optee: add TEE bus device enumeration support")
> Reported-by: Sudeep Holla <sudeep.holla@arm.com>
> Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> ---
>  drivers/tee/optee/core.c          |  3 +++
>  drivers/tee/optee/device.c        | 22 ++++++++++++++++++++++
>  drivers/tee/optee/optee_private.h |  1 +
>  3 files changed, 26 insertions(+)
> 
> diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> index ccad3c7c8f6d..3915dc574503 100644
> --- a/drivers/tee/optee/core.c
> +++ b/drivers/tee/optee/core.c
> @@ -586,6 +586,9 @@ static int optee_remove(struct platform_device *pdev)
>  {
>  	struct optee *optee = platform_get_drvdata(pdev);
>  
> +	/* Unregister OP-TEE specific client devices on TEE bus */
> +	optee_unregister_devices();
> +

This is not based on FF-A support series by Jens I assume. I added
optee_unregister_devices to optee_remove_common and that fixes the issue
I reported. I haven't followed the comments by Jens on the approach yet.

-- 
Regards,
Sudeep

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] tee: optee: Fix missing devices unregister during optee_remove
  2021-10-12 18:03   ` Sudeep Holla
@ 2021-10-13  6:00     ` Sumit Garg
  -1 siblings, 0 replies; 14+ messages in thread
From: Sumit Garg @ 2021-10-13  6:00 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: OP-TEE TrustedFirmware, Jens Wiklander, Jerome Forissier,
	Daniel Thompson, Maxim Uvarov, linux-arm-kernel,
	Linux Kernel Mailing List

On Tue, 12 Oct 2021 at 23:33, Sudeep Holla <sudeep.holla@arm.com> wrote:
>
> On Tue, Oct 12, 2021 at 01:01:16PM +0530, Sumit Garg wrote:
> > When OP-TEE driver is built as a module, OP-TEE client devices
> > registered on TEE bus during probe should be unregistered during
> > optee_remove. So implement optee_unregister_devices() accordingly.
> >
> > Fixes: c3fa24af9244 ("tee: optee: add TEE bus device enumeration support")
> > Reported-by: Sudeep Holla <sudeep.holla@arm.com>
> > Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> > ---
> >  drivers/tee/optee/core.c          |  3 +++
> >  drivers/tee/optee/device.c        | 22 ++++++++++++++++++++++
> >  drivers/tee/optee/optee_private.h |  1 +
> >  3 files changed, 26 insertions(+)
> >
> > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> > index ccad3c7c8f6d..3915dc574503 100644
> > --- a/drivers/tee/optee/core.c
> > +++ b/drivers/tee/optee/core.c
> > @@ -586,6 +586,9 @@ static int optee_remove(struct platform_device *pdev)
> >  {
> >       struct optee *optee = platform_get_drvdata(pdev);
> >
> > +     /* Unregister OP-TEE specific client devices on TEE bus */
> > +     optee_unregister_devices();
> > +
>
> This is not based on FF-A support series by Jens I assume.

Yeah as it fixes an existing problem and for stable backport reasons I
would suggest rebasing FF-A support series on top of it.

> I added
> optee_unregister_devices to optee_remove_common and that fixes the issue
> I reported. I haven't followed the comments by Jens on the approach yet.
>

Thanks for testing this fix.

-Sumit

> --
> Regards,
> Sudeep

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

* Re: [PATCH] tee: optee: Fix missing devices unregister during optee_remove
@ 2021-10-13  6:00     ` Sumit Garg
  0 siblings, 0 replies; 14+ messages in thread
From: Sumit Garg @ 2021-10-13  6:00 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: OP-TEE TrustedFirmware, Jens Wiklander, Jerome Forissier,
	Daniel Thompson, Maxim Uvarov, linux-arm-kernel,
	Linux Kernel Mailing List

On Tue, 12 Oct 2021 at 23:33, Sudeep Holla <sudeep.holla@arm.com> wrote:
>
> On Tue, Oct 12, 2021 at 01:01:16PM +0530, Sumit Garg wrote:
> > When OP-TEE driver is built as a module, OP-TEE client devices
> > registered on TEE bus during probe should be unregistered during
> > optee_remove. So implement optee_unregister_devices() accordingly.
> >
> > Fixes: c3fa24af9244 ("tee: optee: add TEE bus device enumeration support")
> > Reported-by: Sudeep Holla <sudeep.holla@arm.com>
> > Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> > ---
> >  drivers/tee/optee/core.c          |  3 +++
> >  drivers/tee/optee/device.c        | 22 ++++++++++++++++++++++
> >  drivers/tee/optee/optee_private.h |  1 +
> >  3 files changed, 26 insertions(+)
> >
> > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> > index ccad3c7c8f6d..3915dc574503 100644
> > --- a/drivers/tee/optee/core.c
> > +++ b/drivers/tee/optee/core.c
> > @@ -586,6 +586,9 @@ static int optee_remove(struct platform_device *pdev)
> >  {
> >       struct optee *optee = platform_get_drvdata(pdev);
> >
> > +     /* Unregister OP-TEE specific client devices on TEE bus */
> > +     optee_unregister_devices();
> > +
>
> This is not based on FF-A support series by Jens I assume.

Yeah as it fixes an existing problem and for stable backport reasons I
would suggest rebasing FF-A support series on top of it.

> I added
> optee_unregister_devices to optee_remove_common and that fixes the issue
> I reported. I haven't followed the comments by Jens on the approach yet.
>

Thanks for testing this fix.

-Sumit

> --
> Regards,
> Sudeep

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] tee: optee: Fix missing devices unregister during optee_remove
  2021-10-12  8:27     ` Sumit Garg
@ 2021-10-13 12:26       ` Jens Wiklander
  -1 siblings, 0 replies; 14+ messages in thread
From: Jens Wiklander @ 2021-10-13 12:26 UTC (permalink / raw)
  To: Sumit Garg
  Cc: OP-TEE TrustedFirmware, Sudeep Holla, Jerome Forissier,
	Daniel Thompson, Maxim Uvarov, Linux ARM,
	Linux Kernel Mailing List

On Tue, Oct 12, 2021 at 10:27 AM Sumit Garg <sumit.garg@linaro.org> wrote:
>
> Hi Jens,
>
> On Tue, 12 Oct 2021 at 13:29, Jens Wiklander <jens.wiklander@linaro.org> wrote:
> >
> > Hi Sumit,
> >
> > On Tue, Oct 12, 2021 at 9:31 AM Sumit Garg <sumit.garg@linaro.org> wrote:
> > >
> > > When OP-TEE driver is built as a module, OP-TEE client devices
> > > registered on TEE bus during probe should be unregistered during
> > > optee_remove. So implement optee_unregister_devices() accordingly.
> > >
> > > Fixes: c3fa24af9244 ("tee: optee: add TEE bus device enumeration support")
> > > Reported-by: Sudeep Holla <sudeep.holla@arm.com>
> > > Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> > > ---
> > >  drivers/tee/optee/core.c          |  3 +++
> > >  drivers/tee/optee/device.c        | 22 ++++++++++++++++++++++
> > >  drivers/tee/optee/optee_private.h |  1 +
> > >  3 files changed, 26 insertions(+)
> > >
> > > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> > > index ccad3c7c8f6d..3915dc574503 100644
> > > --- a/drivers/tee/optee/core.c
> > > +++ b/drivers/tee/optee/core.c
> > > @@ -586,6 +586,9 @@ static int optee_remove(struct platform_device *pdev)
> > >  {
> > >         struct optee *optee = platform_get_drvdata(pdev);
> > >
> > > +       /* Unregister OP-TEE specific client devices on TEE bus */
> > > +       optee_unregister_devices();
> > > +
> > >         /*
> > >          * Ask OP-TEE to free all cached shared memory objects to decrease
> > >          * reference counters and also avoid wild pointers in secure world
> > > diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c
> > > index ec1d24693eba..128a2d2a50a1 100644
> > > --- a/drivers/tee/optee/device.c
> > > +++ b/drivers/tee/optee/device.c
> > > @@ -53,6 +53,13 @@ static int get_devices(struct tee_context *ctx, u32 session,
> > >         return 0;
> > >  }
> > >
> > > +static void optee_release_device(struct device *dev)
> > > +{
> > > +       struct tee_client_device *optee_device = to_tee_client_device(dev);
> > > +
> > > +       kfree(optee_device);
> > > +}
> > > +
> > >  static int optee_register_device(const uuid_t *device_uuid)
> > >  {
> > >         struct tee_client_device *optee_device = NULL;
> > > @@ -63,6 +70,7 @@ static int optee_register_device(const uuid_t *device_uuid)
> > >                 return -ENOMEM;
> > >
> > >         optee_device->dev.bus = &tee_bus_type;
> > > +       optee_device->dev.release = optee_release_device;
> > >         if (dev_set_name(&optee_device->dev, "optee-ta-%pUb", device_uuid)) {
> > >                 kfree(optee_device);
> > >                 return -ENOMEM;
> > > @@ -154,3 +162,17 @@ int optee_enumerate_devices(u32 func)
> > >  {
> > >         return  __optee_enumerate_devices(func);
> > >  }
> > > +
> > > +static int __optee_unregister_device(struct device *dev, void *data)
> > > +{
> > > +       if (!strncmp(dev_name(dev), "optee-ta", strlen("optee-ta")))
>
> The issue you described below should be handled by this check as we
> would register TAs with unique name corresponding to each OP-TEE
> driver.
>
> > > +               device_unregister(dev);
> > > +
> > > +       return 0;
> > > +}
> > > +
> > > +void optee_unregister_devices(void)
> > > +{
> > > +       bus_for_each_dev(&tee_bus_type, NULL, NULL,
> > > +                        __optee_unregister_device);
> >
> > I had something like this in mind too, but there's one potential
> > problem with this approach. What if there's more than one OP-TEE
> > driver with TAs here? It seems that we'll remove TAs from other
> > drivers too then.
>
> We should be able to easily differentiate among TAs associated with
> any of multiple OP-TEE drivers based on their unique device name.
>
> >
> > This is not likely to be a problem at upstream for the moment so I
> > might be enough just to keep this in mind if/when the OP-TEE driver is
> > extended in a way that there can be multiple OP-TEEs handled.
> >
>
> Given above comments, I think it should be easily handled.

OK, thanks. The patch looks good and it works when testing it on the
upstream kernel and also with the FF-A patch set.
I'm picking up this now.

Cheers,
Jens

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

* Re: [PATCH] tee: optee: Fix missing devices unregister during optee_remove
@ 2021-10-13 12:26       ` Jens Wiklander
  0 siblings, 0 replies; 14+ messages in thread
From: Jens Wiklander @ 2021-10-13 12:26 UTC (permalink / raw)
  To: Sumit Garg
  Cc: OP-TEE TrustedFirmware, Sudeep Holla, Jerome Forissier,
	Daniel Thompson, Maxim Uvarov, Linux ARM,
	Linux Kernel Mailing List

On Tue, Oct 12, 2021 at 10:27 AM Sumit Garg <sumit.garg@linaro.org> wrote:
>
> Hi Jens,
>
> On Tue, 12 Oct 2021 at 13:29, Jens Wiklander <jens.wiklander@linaro.org> wrote:
> >
> > Hi Sumit,
> >
> > On Tue, Oct 12, 2021 at 9:31 AM Sumit Garg <sumit.garg@linaro.org> wrote:
> > >
> > > When OP-TEE driver is built as a module, OP-TEE client devices
> > > registered on TEE bus during probe should be unregistered during
> > > optee_remove. So implement optee_unregister_devices() accordingly.
> > >
> > > Fixes: c3fa24af9244 ("tee: optee: add TEE bus device enumeration support")
> > > Reported-by: Sudeep Holla <sudeep.holla@arm.com>
> > > Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> > > ---
> > >  drivers/tee/optee/core.c          |  3 +++
> > >  drivers/tee/optee/device.c        | 22 ++++++++++++++++++++++
> > >  drivers/tee/optee/optee_private.h |  1 +
> > >  3 files changed, 26 insertions(+)
> > >
> > > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> > > index ccad3c7c8f6d..3915dc574503 100644
> > > --- a/drivers/tee/optee/core.c
> > > +++ b/drivers/tee/optee/core.c
> > > @@ -586,6 +586,9 @@ static int optee_remove(struct platform_device *pdev)
> > >  {
> > >         struct optee *optee = platform_get_drvdata(pdev);
> > >
> > > +       /* Unregister OP-TEE specific client devices on TEE bus */
> > > +       optee_unregister_devices();
> > > +
> > >         /*
> > >          * Ask OP-TEE to free all cached shared memory objects to decrease
> > >          * reference counters and also avoid wild pointers in secure world
> > > diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c
> > > index ec1d24693eba..128a2d2a50a1 100644
> > > --- a/drivers/tee/optee/device.c
> > > +++ b/drivers/tee/optee/device.c
> > > @@ -53,6 +53,13 @@ static int get_devices(struct tee_context *ctx, u32 session,
> > >         return 0;
> > >  }
> > >
> > > +static void optee_release_device(struct device *dev)
> > > +{
> > > +       struct tee_client_device *optee_device = to_tee_client_device(dev);
> > > +
> > > +       kfree(optee_device);
> > > +}
> > > +
> > >  static int optee_register_device(const uuid_t *device_uuid)
> > >  {
> > >         struct tee_client_device *optee_device = NULL;
> > > @@ -63,6 +70,7 @@ static int optee_register_device(const uuid_t *device_uuid)
> > >                 return -ENOMEM;
> > >
> > >         optee_device->dev.bus = &tee_bus_type;
> > > +       optee_device->dev.release = optee_release_device;
> > >         if (dev_set_name(&optee_device->dev, "optee-ta-%pUb", device_uuid)) {
> > >                 kfree(optee_device);
> > >                 return -ENOMEM;
> > > @@ -154,3 +162,17 @@ int optee_enumerate_devices(u32 func)
> > >  {
> > >         return  __optee_enumerate_devices(func);
> > >  }
> > > +
> > > +static int __optee_unregister_device(struct device *dev, void *data)
> > > +{
> > > +       if (!strncmp(dev_name(dev), "optee-ta", strlen("optee-ta")))
>
> The issue you described below should be handled by this check as we
> would register TAs with unique name corresponding to each OP-TEE
> driver.
>
> > > +               device_unregister(dev);
> > > +
> > > +       return 0;
> > > +}
> > > +
> > > +void optee_unregister_devices(void)
> > > +{
> > > +       bus_for_each_dev(&tee_bus_type, NULL, NULL,
> > > +                        __optee_unregister_device);
> >
> > I had something like this in mind too, but there's one potential
> > problem with this approach. What if there's more than one OP-TEE
> > driver with TAs here? It seems that we'll remove TAs from other
> > drivers too then.
>
> We should be able to easily differentiate among TAs associated with
> any of multiple OP-TEE drivers based on their unique device name.
>
> >
> > This is not likely to be a problem at upstream for the moment so I
> > might be enough just to keep this in mind if/when the OP-TEE driver is
> > extended in a way that there can be multiple OP-TEEs handled.
> >
>
> Given above comments, I think it should be easily handled.

OK, thanks. The patch looks good and it works when testing it on the
upstream kernel and also with the FF-A patch set.
I'm picking up this now.

Cheers,
Jens

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] tee: optee: Fix missing devices unregister during optee_remove
  2021-10-13  6:00     ` Sumit Garg
@ 2021-10-13 12:27       ` Jens Wiklander
  -1 siblings, 0 replies; 14+ messages in thread
From: Jens Wiklander @ 2021-10-13 12:27 UTC (permalink / raw)
  To: Sumit Garg
  Cc: Sudeep Holla, OP-TEE TrustedFirmware, Jerome Forissier,
	Daniel Thompson, Maxim Uvarov, linux-arm-kernel,
	Linux Kernel Mailing List

On Wed, Oct 13, 2021 at 8:00 AM Sumit Garg <sumit.garg@linaro.org> wrote:
>
> On Tue, 12 Oct 2021 at 23:33, Sudeep Holla <sudeep.holla@arm.com> wrote:
> >
> > On Tue, Oct 12, 2021 at 01:01:16PM +0530, Sumit Garg wrote:
> > > When OP-TEE driver is built as a module, OP-TEE client devices
> > > registered on TEE bus during probe should be unregistered during
> > > optee_remove. So implement optee_unregister_devices() accordingly.
> > >
> > > Fixes: c3fa24af9244 ("tee: optee: add TEE bus device enumeration support")
> > > Reported-by: Sudeep Holla <sudeep.holla@arm.com>
> > > Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> > > ---
> > >  drivers/tee/optee/core.c          |  3 +++
> > >  drivers/tee/optee/device.c        | 22 ++++++++++++++++++++++
> > >  drivers/tee/optee/optee_private.h |  1 +
> > >  3 files changed, 26 insertions(+)
> > >
> > > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> > > index ccad3c7c8f6d..3915dc574503 100644
> > > --- a/drivers/tee/optee/core.c
> > > +++ b/drivers/tee/optee/core.c
> > > @@ -586,6 +586,9 @@ static int optee_remove(struct platform_device *pdev)
> > >  {
> > >       struct optee *optee = platform_get_drvdata(pdev);
> > >
> > > +     /* Unregister OP-TEE specific client devices on TEE bus */
> > > +     optee_unregister_devices();
> > > +
> >
> > This is not based on FF-A support series by Jens I assume.
>
> Yeah as it fixes an existing problem and for stable backport reasons I
> would suggest rebasing FF-A support series on top of it.
>
> > I added
> > optee_unregister_devices to optee_remove_common and that fixes the issue
> > I reported. I haven't followed the comments by Jens on the approach yet.
> >
>
> Thanks for testing this fix.


I'll rebase the next version of the FF-A patchset on this patch.

Cheers,
Jens

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

* Re: [PATCH] tee: optee: Fix missing devices unregister during optee_remove
@ 2021-10-13 12:27       ` Jens Wiklander
  0 siblings, 0 replies; 14+ messages in thread
From: Jens Wiklander @ 2021-10-13 12:27 UTC (permalink / raw)
  To: Sumit Garg
  Cc: Sudeep Holla, OP-TEE TrustedFirmware, Jerome Forissier,
	Daniel Thompson, Maxim Uvarov, linux-arm-kernel,
	Linux Kernel Mailing List

On Wed, Oct 13, 2021 at 8:00 AM Sumit Garg <sumit.garg@linaro.org> wrote:
>
> On Tue, 12 Oct 2021 at 23:33, Sudeep Holla <sudeep.holla@arm.com> wrote:
> >
> > On Tue, Oct 12, 2021 at 01:01:16PM +0530, Sumit Garg wrote:
> > > When OP-TEE driver is built as a module, OP-TEE client devices
> > > registered on TEE bus during probe should be unregistered during
> > > optee_remove. So implement optee_unregister_devices() accordingly.
> > >
> > > Fixes: c3fa24af9244 ("tee: optee: add TEE bus device enumeration support")
> > > Reported-by: Sudeep Holla <sudeep.holla@arm.com>
> > > Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> > > ---
> > >  drivers/tee/optee/core.c          |  3 +++
> > >  drivers/tee/optee/device.c        | 22 ++++++++++++++++++++++
> > >  drivers/tee/optee/optee_private.h |  1 +
> > >  3 files changed, 26 insertions(+)
> > >
> > > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> > > index ccad3c7c8f6d..3915dc574503 100644
> > > --- a/drivers/tee/optee/core.c
> > > +++ b/drivers/tee/optee/core.c
> > > @@ -586,6 +586,9 @@ static int optee_remove(struct platform_device *pdev)
> > >  {
> > >       struct optee *optee = platform_get_drvdata(pdev);
> > >
> > > +     /* Unregister OP-TEE specific client devices on TEE bus */
> > > +     optee_unregister_devices();
> > > +
> >
> > This is not based on FF-A support series by Jens I assume.
>
> Yeah as it fixes an existing problem and for stable backport reasons I
> would suggest rebasing FF-A support series on top of it.
>
> > I added
> > optee_unregister_devices to optee_remove_common and that fixes the issue
> > I reported. I haven't followed the comments by Jens on the approach yet.
> >
>
> Thanks for testing this fix.


I'll rebase the next version of the FF-A patchset on this patch.

Cheers,
Jens

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-10-13 13:14 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12  7:31 [PATCH] tee: optee: Fix missing devices unregister during optee_remove Sumit Garg
2021-10-12  7:31 ` Sumit Garg
2021-10-12  7:59 ` Jens Wiklander
2021-10-12  7:59   ` Jens Wiklander
2021-10-12  8:27   ` Sumit Garg
2021-10-12  8:27     ` Sumit Garg
2021-10-13 12:26     ` Jens Wiklander
2021-10-13 12:26       ` Jens Wiklander
2021-10-12 18:03 ` Sudeep Holla
2021-10-12 18:03   ` Sudeep Holla
2021-10-13  6:00   ` Sumit Garg
2021-10-13  6:00     ` Sumit Garg
2021-10-13 12:27     ` Jens Wiklander
2021-10-13 12:27       ` Jens Wiklander

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.