Skip to content

Commit

Permalink
powerpc/eeh: Drop taken reference to driver on eeh_rmv_device
Browse files Browse the repository at this point in the history
Commit f5c5771 ("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 if it was taken.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Acked-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Thadeu Lima de Souza Cascardo authored and Benjamin Herrenschmidt committed Feb 11, 2014
1 parent 0215b4a commit 8cc6b6c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions arch/powerpc/kernel/eeh_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,13 @@ static void *eeh_rmv_device(void *data, void *userdata)
*/
if (!dev || (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE))
return NULL;

driver = eeh_pcid_get(dev);
if (driver && driver->err_handler)
return NULL;
if (driver) {
eeh_pcid_put(dev);
if (driver->err_handler)
return NULL;
}

/* Remove it from PCI subsystem */
pr_debug("EEH: Removing %s without EEH sensitive driver\n",
Expand Down

0 comments on commit 8cc6b6c

Please sign in to comment.