All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	Ross Zwisler <ross.zwisler@linux.intel.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] parport: register driver later
Date: Mon, 7 Mar 2016 10:32:55 -0700	[thread overview]
Message-ID: <20160307173255.GA26456@linux.intel.com> (raw)
In-Reply-To: <1457277010-30593-1-git-send-email-sudipm.mukherjee@gmail.com>

On Sun, Mar 06, 2016 at 08:40:10PM +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>
> Cc: <stable@vger.kernel.org> # 4.2+
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> ---
> 
> Hi Ross,
> Can you please test this patch in your setup. This is a respin of the
> previous patch in another way.

Yep, this also solves the issue for me.

Tested-by: Ross Zwisler <ross.zwisler@linux.intel.com>

>  drivers/parport/share.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/parport/share.c b/drivers/parport/share.c
> index 3308427..c1eba80 100644
> --- a/drivers/parport/share.c
> +++ b/drivers/parport/share.c
> @@ -135,9 +135,18 @@ static struct bus_type parport_bus_type = {
>  	.probe = parport_probe,
>  };
>  
> +static bool is_registered;
> +
>  int parport_bus_init(void)
>  {
> -	return bus_register(&parport_bus_type);
> +	int ret;
> +
> +	ret = bus_register(&parport_bus_type);
> +	if (ret)
> +		return ret;
> +
> +	is_registered = true;
> +	return 0;
>  }
>  
>  void parport_bus_exit(void)
> @@ -273,6 +282,9 @@ int __parport_register_driver(struct parport_driver *drv, struct module *owner,
>  		/* using device model */
>  		int ret;
>  
> +		if (!is_registered)
> +			return -EAGAIN;
> +
>  		/* initialize common driver fields */
>  		drv->driver.name = drv->name;
>  		drv->driver.bus = &parport_bus_type;
> -- 
> 1.9.1

  reply	other threads:[~2016-03-07 17:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-06 15:10 [PATCH v2] parport: register driver later Sudip Mukherjee
2016-03-07 17:32 ` Ross Zwisler [this message]
2016-04-05  5:26   ` Sudip Mukherjee
2016-04-05 12:58     ` Greg KH
2016-04-05 13:17       ` Sudip Mukherjee
2016-04-05 13:42         ` Greg KH
2016-04-05 13:44       ` Linus Torvalds
2016-04-05 13:47         ` Greg KH
2016-04-05 14:07           ` Linus Torvalds
     [not found] ` <CA+55aFz0A07bbfSiCuBo4PPnEje1--zPSLuNzYrxqhj0gZFaWA@mail.gmail.com>
2016-04-05 11:54   ` Sudip Mukherjee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160307173255.GA26456@linux.intel.com \
    --to=ross.zwisler@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=sudipm.mukherjee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.