[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wjzqaqcicTtWfBtXyytJs1nqjJNved2JFsLVsVLYgVkuQ@mail.gmail.com>
Date: Sat, 20 Apr 2024 11:02:48 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Jiri Slaby <jirislaby@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>, "Starke, Daniel" <daniel.starke@...mens.com>,
LKML <linux-kernel@...r.kernel.org>,
linux-security-module <linux-security-module@...r.kernel.org>
Subject: Re: [PATCH v2] tty: n_gsm: restrict tty devices to attach
On Sat, 20 Apr 2024 at 10:34, Linus Torvalds
<torvalds@...ux-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
Powered by blists - more mailing lists