From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Matthias Reichl <hias@horus.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
speakup@linux-speakup.org, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: Crash when specifying non-existent serial port in speakup / tty_kopen
Date: Wed, 4 Nov 2020 21:13:23 +0100 [thread overview]
Message-ID: <20201104201323.dzyt73tbd2jykcrt@function> (raw)
In-Reply-To: <20201104145737.GA11024@camel2.lan>
Hello,
Matthias Reichl, le mer. 04 nov. 2020 15:57:37 +0100, a ecrit:
> I initially noticed this oops on x86_64 running kernel 5.4.59 when
> I accidentally mistyped "ttyS0" as "ttyS9":
>
> modprobe speakup_dummy dev=ttyS9
> [ 49.978481] tty_init_dev: ttyS driver does not set tty->port. This would crash the kernel. Fix the driver!
This looks like only a warning, did it actually crash?
> the missing tty->port is quite fatal.
It is fatal for module insertion yes (EINVAL) but IIRC that should be
getting handled properly, making modprobe return the error?
> It looks like spk_ttyio or tty_dev_name_to_number() / tty_kopen()
> should perform some additional validation,
spk_ttyio_initialise_ldisc only has a dev_t so can't do much beyond
calling tty_kopen.
tty_kopen is getting the index from the tty_lookup_driver call (actually
get_tty_driver which uses p->minor_start and p->num) and passes it to
tty_driver_lookup_tty. Perhaps in addition of p->num the driver should
have another field to set, that tty_init_dev could use to reject with
ENODEV indexes beyond what the driver actually provides?
> I couldn't make the kernel warn/crash yet by specifying non-existent
> ttyUSB ports yet though.
That's probably because in the ttyUSB case the device allocation is
dynamic and made exactly according to the number of actual devices,
while for ttyS* there is a large overcommit of minor values.
Samuel
next prev parent reply other threads:[~2020-11-04 20:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-04 14:57 Crash when specifying non-existent serial port in speakup / tty_kopen Matthias Reichl
2020-11-04 20:13 ` Samuel Thibault [this message]
2020-11-04 21:15 ` Matthias Reichl
2020-11-04 21:30 ` Samuel Thibault
2020-11-05 12:21 ` Matthias Reichl
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=20201104201323.dzyt73tbd2jykcrt@function \
--to=samuel.thibault@ens-lyon.org \
--cc=gregkh@linuxfoundation.org \
--cc=hias@horus.com \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=speakup@linux-speakup.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 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.