[PATCH] parport: register driver later

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the parport bus is not yet registered and any device using parallel
port tries to register with the bus we get a stackdump with a message
of Kernel bug.

Reported-by: Fengguang Wu <fengguang.wu@xxxxxxxxx>
Tested-by: Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx> # 4.2+ 
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@xxxxxxxxxxxxxxx>
---

We should actually have some deferred probe here. But considering that
you will be closing your trees soon so a quick fix to solve the problem
for now. We will revisit this when we remove the old api (hopefully v4.7).

 drivers/parport/share.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index 3308427..176b2b6 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -273,6 +273,9 @@ int __parport_register_driver(struct parport_driver *drv, struct module *owner,
 		/* using device model */
 		int ret;
 
+		if (!parport_bus_type.p)
+			return -EAGAIN;
+
 		/* initialize common driver fields */
 		drv->driver.name = drv->name;
 		drv->driver.bus = &parport_bus_type;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]