* [PATCH] parport: register driver later
@ 2016-03-04 10:50 Sudip Mukherjee
2016-03-05 20:19 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Sudip Mukherjee @ 2016-03-04 10:50 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, Sudip Mukherjee, stable
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@intel.com>
Tested-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: <stable@vger.kernel.org> # 4.2+
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] parport: register driver later
2016-03-04 10:50 [PATCH] parport: register driver later Sudip Mukherjee
@ 2016-03-05 20:19 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2016-03-05 20:19 UTC (permalink / raw)
To: Sudip Mukherjee; +Cc: linux-kernel, stable
On Fri, Mar 04, 2016 at 04:20:59PM +0530, Sudip Mukherjee wrote:
> 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@intel.com>
> Tested-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> Cc: <stable@vger.kernel.org> # 4.2+
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> ---
>
> 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;
I really don't like it when busses poke into the driver-core
internal-only structures like this. Why can't you have your own "have
been registered" flag instead if you really need it? Don't rely on the
driver core here to be doing this always this way, perhaps p could be
NULL and it only is created later on somehow?
I need to rename 'p' to "do_not_touch_you_have_been_warned" or something
else...
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-05 20:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-04 10:50 [PATCH] parport: register driver later Sudip Mukherjee
2016-03-05 20:19 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).