[PATCH v2] tty: n_gsm: restrict tty devices to attach
Linus Torvalds
torvalds at linux-foundation.org
Sat Apr 20 18:02:48 UTC 2024
On Sat, 20 Apr 2024 at 10:34, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
>
> Alternatively, we could go the opposite way, and have some flag in the
> line discipline that says "I can be a console", and just check that in
> tty_set_ldisc() for the console.
Actually, I take that back. It's not /dev/console that is the problem,
that just happened to be the one oops I looked at.
Most other normal tty devices just expect ->write() to be called in
normal process context, so if we do a line discipline flag, it would
have to be something like "I'm ok with being called with interrupts
disabled", and then the n_gsm ->open function would just check that.
So it would end up being just another form of that
+ if (tty->ops->set_serial == NULL)
+ return -EINVAL;
check - but maybe more explicit and prettier.
Because a real serial driver might not be ok with it either, if it
uses a semaphore or something.
Whatever. I think the 'set_serial' test would at least be an improvement.
Linus
More information about the Linux-security-module-archive
mailing list