[PATCH] powerpc/eeh: drop taken reference to driver on eeh_rmv_device

Thadeu Lima de Souza Cascardo cascardo at linux.vnet.ibm.com
Fri Jan 31 00:00:48 EST 2014


Commit f5c57710dd62dd06f176934a8b4b8accbf00f9f8 ("powerpc/eeh: Use
partial hotplug for EEH unaware drivers") introduces eeh_rmv_device,
which may grab a reference to a driver, but not release it.

That prevents a driver from being removed after it has gone through EEH
recovery.

This patch drops the reference in either exit path if it was taken.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo at linux.vnet.ibm.com>
---
 arch/powerpc/kernel/eeh_driver.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c
index 7bb30dc..afe7337 100644
--- a/arch/powerpc/kernel/eeh_driver.c
+++ b/arch/powerpc/kernel/eeh_driver.c
@@ -364,7 +364,7 @@ static void *eeh_rmv_device(void *data, void *userdata)
 		return NULL;
 	driver = eeh_pcid_get(dev);
 	if (driver && driver->err_handler)
-		return NULL;
+		goto out;
 
 	/* Remove it from PCI subsystem */
 	pr_debug("EEH: Removing %s without EEH sensitive driver\n",
@@ -377,6 +377,9 @@ static void *eeh_rmv_device(void *data, void *userdata)
 	pci_stop_and_remove_bus_device(dev);
 	pci_unlock_rescan_remove();
 
+out:
+	if (driver)
+		eeh_pcid_put(dev);
 	return NULL;
 }
 
-- 
1.7.1



More information about the Linuxppc-dev mailing list