Skip to contentSkip to conversation

driver core: Release all resources during unbind before updating device links

PATCH In review Saravana Kannan 4 participants 5 messages Oct 18, 2023 – Oct 21, 2023 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 driver core: Release all resources during unbind before updating device links

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")
Cc Thierry Reding <[email protected]>
Cc Yang Yingliang <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Mark Brown <[email protected]>
Cc Matti Vaittinen <[email protected]>
Cc James Clark <[email protected]>
---
 drivers/base/dd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/dd.c +1 -1
index a528cec24264..0c3725c3eefa 100644
@@ -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);
Signature · 1 line
2.42.0.655.g421f12c284-goog
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Saravana Kannan

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.

Quoted 10 lines
Fixes 9ed9895370ae ("driver core: Functional dependencies tracking support")
Cc Thierry Reding <[email protected]>
Cc Yang Yingliang <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Mark Brown <[email protected]>
Cc Matti Vaittinen <[email protected]>
Cc James Clark <[email protected]>
Quoted 21 lines
---
 drivers/base/dd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/dd.c +1 -2
index a528cec24264..0c3725c3eefa 100644
@@ -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

Tested-by Acked-by on v1 1/1
#2 lore raw
In reply to Saravana Kannan
Quoted 24 lines · Saravana Kannan

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")
Cc Thierry Reding <[email protected]>
Cc Yang Yingliang <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Mark Brown <[email protected]>
Cc Matti Vaittinen <[email protected]>
Cc James Clark <[email protected]>
---
 drivers/base/dd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/dd.c +0 -0
index a528cec24264..0c3725c3eefa 100644

drivers/base/dd.c static void __device_release_driver(struct device *dev, struct device *parent) · line 1278

Quoted 6 lines
drivers/base/dd.c +1 -1
@@ -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);

This indeed fixes the crash I experinced before.

Thanks a lot!
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#3 lore raw
Quoted 29 lines · Uwe Kleine-König
Quoted 27 lines · Saravana Kannan

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")
Cc Thierry Reding <[email protected]>
Cc Yang Yingliang <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Mark Brown <[email protected]>
Cc Matti Vaittinen <[email protected]>
Cc James Clark <[email protected]>
---
 drivers/base/dd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/dd.c +0 -0
index a528cec24264..0c3725c3eefa 100644
@@ -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);
 
Quoted 8 lines

drivers/base/dd.c static void __device_release_driver(struct device *dev, struct device *parent) · line 1278

Quoted 3 lines
drivers/base/dd.c +1 -1
-             device_links_driver_cleanup(dev);
              device_unbind_cleanup(dev);
+             device_links_driver_cleanup(dev);

This indeed fixes the crash I experinced before.

Thanks for the Tested-by!

-Saravana

#4 lore raw
In reply to Saravana Kannan
Quoted 36 lines · Saravana Kannan

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")
Cc Thierry Reding <[email protected]>
Cc Yang Yingliang <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Mark Brown <[email protected]>
Cc Matti Vaittinen <[email protected]>
Cc James Clark <[email protected]>
---
 drivers/base/dd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/dd.c +1 -1
index a528cec24264..0c3725c3eefa 100644
@@ -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);
Signature · 1 line
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