Re: [PATCH 1/1] tty: n_gsm: Avoid sleeping during .write() whilst atomic

From: Greg Kroah-Hartman
Date: Thu Oct 05 2023 - 10:48:39 EST


On Thu, Oct 05, 2023 at 12:46:32PM +0100, Lee Jones wrote:
> On Thu, 05 Oct 2023, Starke, Daniel wrote:
>
> > > > Would something like this tick that box?
> > > >
> > > > diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index
> > > > 1f3aba607cd51..5c1d2fcd5d9e2 100644
> > > > --- a/drivers/tty/n_gsm.c
> > > > +++ b/drivers/tty/n_gsm.c
> > > > @@ -3716,6 +3716,10 @@ static ssize_t gsmld_write(struct tty_struct *tty, struct file *file,
> > > > if (!gsm)
> > > > return -ENODEV;
> > > >
> > > > + /* The GSM line discipline does not support binding to console */
> > > > + if (strncmp(tty->name, "tty", 3))
> > > > + return -EINVAL;
> > >
> > > No, that's not going to work, some consoles do not start with "tty" :(
>
> Ah, you mean there are others that we need to consider?
>
> I was just covering off con_write() from drivers/tty/vt/vt.c.
>
> Does anyone have a counter proposal?

consoles are dynamically assigned, the device knows if it is a console
or not, so there is a way to determine this at runtime. It's not a
device naming thing at all.

thanks,

greg k-h