LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] driver core: Release all resources during unbind before updating device links
@ 2023-10-18  1:38 Saravana Kannan
  2023-10-18 10:17 ` Rafael J. Wysocki
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Saravana Kannan @ 2023-10-18  1:38 UTC (permalink / raw
  To: Greg Kroah-Hartman, Rafael J. Wysocki
  Cc: Saravana Kannan, Uwe Kleine-König, Thierry Reding,
	Yang Yingliang, Andy Shevchenko, Mark Brown, Matti Vaittinen,
	James Clark, kernel-team, Rafael J. Wysocki, linux-kernel

This commit fixes a bug in commit 9ed9895370ae ("driver core: Functional
dependencies tracking support") where the device link status was
incorrectly updated in the driver unbind path before all the device's
resources were released.

Fixes: 9ed9895370ae ("driver core: Functional dependencies tracking support")
Reported-by: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Closes: https://lore.kernel.org/all/20231014161721.f4iqyroddkcyoefo@pengutronix.de/
Signed-off-by: Saravana Kannan <saravanak@google.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Yang Yingliang <yangyingliang@huawei.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Matti Vaittinen <mazziesaccount@gmail.com>
Cc: James Clark <james.clark@arm.com>
---
 drivers/base/dd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index a528cec24264..0c3725c3eefa 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -1274,8 +1274,8 @@ static void __device_release_driver(struct device *dev, struct device *parent)
 		if (dev->bus && dev->bus->dma_cleanup)
 			dev->bus->dma_cleanup(dev);
 
-		device_links_driver_cleanup(dev);
 		device_unbind_cleanup(dev);
+		device_links_driver_cleanup(dev);
 
 		klist_remove(&dev->p->knode_driver);
 		device_pm_check_callbacks(dev);
-- 
2.42.0.655.g421f12c284-goog


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

* Re: [PATCH v1] driver core: Release all resources during unbind before updating device links
  2023-10-18  1:38 [PATCH v1] driver core: Release all resources during unbind before updating device links Saravana Kannan
@ 2023-10-18 10:17 ` Rafael J. Wysocki
  2023-10-18 10:40 ` Uwe Kleine-König
  2023-10-21 21:06 ` Greg Kroah-Hartman
  2 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2023-10-18 10:17 UTC (permalink / raw
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Uwe Kleine-König,
	Thierry Reding, Yang Yingliang, Andy Shevchenko, Mark Brown,
	Matti Vaittinen, James Clark, kernel-team, Rafael J. Wysocki,
	linux-kernel

On Wed, Oct 18, 2023 at 3:38 AM Saravana Kannan <saravanak@google.com> wrote:
>
> This commit fixes a bug in commit 9ed9895370ae ("driver core: Functional
> dependencies tracking support") where the device link status was
> incorrectly updated in the driver unbind path before all the device's
> resources were released.
>
> Fixes: 9ed9895370ae ("driver core: Functional dependencies tracking support")
> Reported-by: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
> Closes: https://lore.kernel.org/all/20231014161721.f4iqyroddkcyoefo@pengutronix.de/
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Yang Yingliang <yangyingliang@huawei.com>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Matti Vaittinen <mazziesaccount@gmail.com>
> Cc: James Clark <james.clark@arm.com>

Acked-by: Rafael J. Wysocki <rafael@kernel.org>

> ---
>  drivers/base/dd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index a528cec24264..0c3725c3eefa 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -1274,8 +1274,8 @@ static void __device_release_driver(struct device *dev, struct device *parent)
>                 if (dev->bus && dev->bus->dma_cleanup)
>                         dev->bus->dma_cleanup(dev);
>
> -               device_links_driver_cleanup(dev);
>                 device_unbind_cleanup(dev);
> +               device_links_driver_cleanup(dev);
>
>                 klist_remove(&dev->p->knode_driver);
>                 device_pm_check_callbacks(dev);
> --
> 2.42.0.655.g421f12c284-goog
>

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

* Re: [PATCH v1] driver core: Release all resources during unbind before updating device links
  2023-10-18  1:38 [PATCH v1] driver core: Release all resources during unbind before updating device links Saravana Kannan
  2023-10-18 10:17 ` Rafael J. Wysocki
@ 2023-10-18 10:40 ` Uwe Kleine-König
  2023-10-18 22:25   ` Saravana Kannan
  2023-10-21 21:06 ` Greg Kroah-Hartman
  2 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2023-10-18 10:40 UTC (permalink / raw
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Thierry Reding,
	Yang Yingliang, Andy Shevchenko, Mark Brown, Matti Vaittinen,
	James Clark, kernel-team, Rafael J. Wysocki, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1797 bytes --]

On Tue, Oct 17, 2023 at 06:38:50PM -0700, Saravana Kannan wrote:
> This commit fixes a bug in commit 9ed9895370ae ("driver core: Functional
> dependencies tracking support") where the device link status was
> incorrectly updated in the driver unbind path before all the device's
> resources were released.
> 
> Fixes: 9ed9895370ae ("driver core: Functional dependencies tracking support")
> Reported-by: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
> Closes: https://lore.kernel.org/all/20231014161721.f4iqyroddkcyoefo@pengutronix.de/
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Yang Yingliang <yangyingliang@huawei.com>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Matti Vaittinen <mazziesaccount@gmail.com>
> Cc: James Clark <james.clark@arm.com>
> ---
>  drivers/base/dd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index a528cec24264..0c3725c3eefa 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -1274,8 +1274,8 @@ static void __device_release_driver(struct device *dev, struct device *parent)
>  		if (dev->bus && dev->bus->dma_cleanup)
>  			dev->bus->dma_cleanup(dev);
>  
> -		device_links_driver_cleanup(dev);
>  		device_unbind_cleanup(dev);
> +		device_links_driver_cleanup(dev);

Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

This indeed fixes the crash I experinced before.

Thanks a lot!
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v1] driver core: Release all resources during unbind before updating device links
  2023-10-18 10:40 ` Uwe Kleine-König
@ 2023-10-18 22:25   ` Saravana Kannan
  0 siblings, 0 replies; 5+ messages in thread
From: Saravana Kannan @ 2023-10-18 22:25 UTC (permalink / raw
  To: Uwe Kleine-König
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Thierry Reding,
	Yang Yingliang, Andy Shevchenko, Mark Brown, Matti Vaittinen,
	James Clark, kernel-team, Rafael J. Wysocki, linux-kernel

On Wed, Oct 18, 2023 at 3:40 AM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> On Tue, Oct 17, 2023 at 06:38:50PM -0700, Saravana Kannan wrote:
> > This commit fixes a bug in commit 9ed9895370ae ("driver core: Functional
> > dependencies tracking support") where the device link status was
> > incorrectly updated in the driver unbind path before all the device's
> > resources were released.
> >
> > Fixes: 9ed9895370ae ("driver core: Functional dependencies tracking support")
> > Reported-by: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
> > Closes: https://lore.kernel.org/all/20231014161721.f4iqyroddkcyoefo@pengutronix.de/
> > Signed-off-by: Saravana Kannan <saravanak@google.com>
> > Cc: Thierry Reding <thierry.reding@gmail.com>
> > Cc: Yang Yingliang <yangyingliang@huawei.com>
> > Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Cc: Mark Brown <broonie@kernel.org>
> > Cc: Matti Vaittinen <mazziesaccount@gmail.com>
> > Cc: James Clark <james.clark@arm.com>
> > ---
> >  drivers/base/dd.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> > index a528cec24264..0c3725c3eefa 100644
> > --- a/drivers/base/dd.c
> > +++ b/drivers/base/dd.c
> > @@ -1274,8 +1274,8 @@ static void __device_release_driver(struct device *dev, struct device *parent)
> >               if (dev->bus && dev->bus->dma_cleanup)
> >                       dev->bus->dma_cleanup(dev);
> >
> > -             device_links_driver_cleanup(dev);
> >               device_unbind_cleanup(dev);
> > +             device_links_driver_cleanup(dev);
>
> Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>
> This indeed fixes the crash I experinced before.

Thanks for the Tested-by!

-Saravana

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

* Re: [PATCH v1] driver core: Release all resources during unbind before updating device links
  2023-10-18  1:38 [PATCH v1] driver core: Release all resources during unbind before updating device links Saravana Kannan
  2023-10-18 10:17 ` Rafael J. Wysocki
  2023-10-18 10:40 ` Uwe Kleine-König
@ 2023-10-21 21:06 ` Greg Kroah-Hartman
  2 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2023-10-21 21:06 UTC (permalink / raw
  To: Saravana Kannan
  Cc: Rafael J. Wysocki, Uwe Kleine-König, Thierry Reding,
	Yang Yingliang, Andy Shevchenko, Mark Brown, Matti Vaittinen,
	James Clark, kernel-team, Rafael J. Wysocki, linux-kernel

On Tue, Oct 17, 2023 at 06:38:50PM -0700, Saravana Kannan wrote:
> This commit fixes a bug in commit 9ed9895370ae ("driver core: Functional
> dependencies tracking support") where the device link status was
> incorrectly updated in the driver unbind path before all the device's
> resources were released.
> 
> Fixes: 9ed9895370ae ("driver core: Functional dependencies tracking support")
> Reported-by: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
> Closes: https://lore.kernel.org/all/20231014161721.f4iqyroddkcyoefo@pengutronix.de/
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Yang Yingliang <yangyingliang@huawei.com>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Matti Vaittinen <mazziesaccount@gmail.com>
> Cc: James Clark <james.clark@arm.com>
> ---
>  drivers/base/dd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index a528cec24264..0c3725c3eefa 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -1274,8 +1274,8 @@ static void __device_release_driver(struct device *dev, struct device *parent)
>  		if (dev->bus && dev->bus->dma_cleanup)
>  			dev->bus->dma_cleanup(dev);
>  
> -		device_links_driver_cleanup(dev);
>  		device_unbind_cleanup(dev);
> +		device_links_driver_cleanup(dev);
>  
>  		klist_remove(&dev->p->knode_driver);
>  		device_pm_check_callbacks(dev);
> -- 
> 2.42.0.655.g421f12c284-goog
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- You have marked a patch with a "Fixes:" tag for a commit that is in an
  older released kernel, yet you do not have a cc: stable line in the
  signed-off-by area at all, which means that the patch will not be
  applied to any older kernel releases.  To properly fix this, please
  follow the documented rules in the
  Documentation/process/stable-kernel-rules.rst file for how to resolve
  this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

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

end of thread, other threads:[~2023-10-21 21:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-18  1:38 [PATCH v1] driver core: Release all resources during unbind before updating device links Saravana Kannan
2023-10-18 10:17 ` Rafael J. Wysocki
2023-10-18 10:40 ` Uwe Kleine-König
2023-10-18 22:25   ` Saravana Kannan
2023-10-21 21:06 ` Greg Kroah-Hartman

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 read-only IMAP folder(s) and NNTP newsgroup(s).