From: Rodolfo Giometti <giometti@enneenne.com>
To: Jiri Slaby <jslaby@suse.cz>, akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH -resend] pps: do not crash when failed to register
Date: Thu, 14 Jul 2016 14:05:02 +0200 [thread overview]
Message-ID: <57877FEE.6020405@enneenne.com> (raw)
In-Reply-To: <20160714115245.12651-1-jslaby@suse.cz>
On 07/14/16 13:52, Jiri Slaby wrote:
> With this command sequence:
> modprobe plip
> modprobe pps_parport
> rmmod pps_parport
> the partport_pps modules causes this crash:
>
> ===
>
> BUG: unable to handle kernel NULL pointer dereference at (null)
> IP: [<ffffffffa110301d>] parport_detach+0x1d/0x60 [pps_parport]
> Oops: 0000 [#1] SMP
> ...
> Call Trace:
> [<ffffffffa036a185>] parport_unregister_driver+0x65/0xc0 [parport]
> [<ffffffff810ff667>] SyS_delete_module+0x187/0x210
>
> ===
>
> 1) plip is loaded and takes the parport device for exclusive use:
> plip0: Parallel port at 0x378, using IRQ 7.
>
> 2) pps_parport then fails to grab the device:
> pps_parport: parallel port PPS client
> parport0: cannot grant exclusive access for device pps_parport
> pps_parport: couldn't register with parport0
>
> 3) rmmod of pps_parport is then killed because it tries to access
> pardev->name, but pardev (taken from port->cad) is NULL.
>
> So add a check for NULL in the test there too.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Rodolfo Giometti <giometti@enneenne.com>
> ---
> drivers/pps/clients/pps_parport.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pps/clients/pps_parport.c b/drivers/pps/clients/pps_parport.c
> index 38a8bbe74810..83797d89c30f 100644
> --- a/drivers/pps/clients/pps_parport.c
> +++ b/drivers/pps/clients/pps_parport.c
> @@ -195,7 +195,7 @@ static void parport_detach(struct parport *port)
> struct pps_client_pp *device;
>
> /* FIXME: oooh, this is ugly! */
> - if (strcmp(pardev->name, KBUILD_MODNAME))
> + if (!pardev || strcmp(pardev->name, KBUILD_MODNAME))
> /* not our port */
> return;
>
>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
--
HCE Engineering e-mail: giometti@hce-engineering.com
GNU/Linux Solutions giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
prev parent reply other threads:[~2016-07-14 12:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-14 11:52 [PATCH -resend] pps: do not crash when failed to register Jiri Slaby
2016-07-14 12:05 ` Rodolfo Giometti [this message]
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=57877FEE.6020405@enneenne.com \
--to=giometti@enneenne.com \
--cc=akpm@linux-foundation.org \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox