__pci_register_driver() error path forgot to unwind.
driver_unregister() needs to be called when pci_create_newid_file() failed.
Cc: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Akinobu Mita <[email protected]>
drivers/pci/pci-driver.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Index: work-fault-inject/drivers/pci/pci-driver.c
===================================================================
--- work-fault-inject.orig/drivers/pci/pci-driver.c
+++ work-fault-inject/drivers/pci/pci-driver.c
@@ -445,9 +445,12 @@ int __pci_register_driver(struct pci_dri
/* register with core */
error = driver_register(&drv->driver);
+ if (error)
+ return error;
- if (!error)
- error = pci_create_newid_file(drv);
+ error = pci_create_newid_file(drv);
+ if (error)
+ driver_unregister(&drv->driver);
return error;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]