Re: tty crash in tty_ldisc_receive_buf()

From: Michael Neuling
Date: Thu Apr 06 2017 - 22:06:13 EST



> > + /* This probably shouldn't happen, but return 0 data processed */
> > + if (!ldata)
> > + return 0;
> > +
> > Â while (1) {
> > Â /*
> > Â Â* When PARMRK is set, each input char may take up to 3
> > chars
>
> Maybe your patch should looks like:
> + /* This probably shouldn't happen, but return 0 data processed */
> + if (!ldata) {
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂup_read(&tty->termios_rwsem);
> + return 0;
> +ÂÂÂÂÂÂÂ}

Oops, nice catch.. Thanks!

That does indeed fix the problem now without the softlockup. I'm not sure it's
the right fix, but full patch below.

Anyone see a problem with this approach? Am I just papering over a real issue?

> Maybe below patch should work:
> @@ -1668,11 +1668,12 @@ static int
> Ân_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp,
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂchar *fp, int count, int flow)
> Â{
> -ÂÂÂÂÂÂÂstruct n_tty_data *ldata = tty->disc_data;
> +ÂÂÂÂÂÂÂstruct n_tty_data *ldata;
> ÂÂÂÂÂÂÂÂÂÂÂint room, n, rcvd = 0, overflow;
>
> ÂÂÂÂÂÂÂÂdown_read(&tty->termios_rwsem);
>
> +ÂÂÂÂÂÂÂldata = tty->disc_data;

I did try just that alone and it didn't help.

Mikey


------------------------------------------------------------------------