From: Peter Hurley <peter@hurleysoftware.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-serial@vger.kernel.org
Subject: Re: [PATCH] serial: 8250: Prevent kernel crash with nr_uarts=0
Date: Mon, 04 May 2015 14:52:49 -0400 [thread overview]
Message-ID: <5547C001.8040400@hurleysoftware.com> (raw)
In-Reply-To: <5547B04C.8080706@siemens.com>
On 05/04/2015 01:45 PM, Jan Kiszka wrote:
> On 2015-05-04 19:02, Peter Hurley wrote:
>> Hi Jan,
>>
>> On 05/04/2015 12:01 PM, Jan Kiszka wrote:
>>> When nr_uarts was set to 0 (via config or 8250_core.nr_uarts), we crash
>>> early on x86 because serial8250_isa_init_ports dereferences base_ops
>>> which remains NULL. In fact, there is nothing to do for that function if
>>> there are no uarts.
>>
>> Thanks for finding this.
>>
>> So nr_uarts == 0 effectively disables the 8250 driver. Is there any
>> reason not to simply abort the driver init instead?
>
> I'm not very deep into this code, just stumbled over this while trying
> some, well, unusual configurations.
Ok; I wasn't sure if this was related to some weird setup that needed
the 8250 driver loaded but in-op.
> If you prefer to handle this differently, I can recode it, of course.
Yes, please. We should bail out of any initialization if nr_uarts == 0.
That would be:
1. univ8250_console_init()
The return value is ignored but the console should not be registered.
2. early_serial_setup()
if (nr_uarts == 0)
return -ENODEV;
3. serial8250_init()
if (nr_uarts == 0)
return -ENODEV;
Regards,
Peter Hurley
next prev parent reply other threads:[~2015-05-04 18:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-04 16:01 [PATCH] serial: 8250: Prevent kernel crash with nr_uarts=0 Jan Kiszka
2015-05-04 17:02 ` Peter Hurley
2015-05-04 17:45 ` Jan Kiszka
2015-05-04 18:52 ` Peter Hurley [this message]
2015-05-05 6:26 ` [PATCH] serial: 8250: Do nothing if nr_uarts=0 Jan Kiszka
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=5547C001.8040400@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=gregkh@linuxfoundation.org \
--cc=jan.kiszka@siemens.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@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;
as well as URLs for NNTP newsgroup(s).