Re: [PATCH] tty: fix data race in n_tty_receive_buf_common

From: Alan Cox
Date: Fri Jan 05 2018 - 16:08:01 EST


On Sat, 6 Jan 2018 01:54:36 +0530
"Kohli, Gaurav" <gkohli@xxxxxxxxxxxxxx> wrote:

> Hi Alan,
>
> Sorry correcting the typo here:
> +retval =Â tty_ldisc_lock(tty, 5 * HZ);
> +if (retval)
> +ÂÂÂÂ ÂÂÂ goto err_release_lock;
> tty->port->itty = tty;
> /*
> * Structures all installed ... call the ldisc open routines.
> * If we fail here just call release_tty to clean up. No need
> * to decrement the use counts, as release_tty doesn't care.
> */
> retval = tty_ldisc_setup(tty, tty->link);
> ÂÂÂ ÂÂÂ if (retval)
> ÂÂÂ ÂÂÂ ÂÂÂ goto err_release_tty;
> tty_ldisc_unlock(tty);
> err_release_tty:
> tty_info_ratelimited(tty, "ldisc open failed (%d), clearing slot %d\n",
> ÂÂÂ retval, idx);
> +err_release_lock;
> +tty_unlock(tty);
> +release_tty(tty, idx);
> +tty_ldisc_unlock(tty);
> +return ERR_PTR(retval);

Thanks - can you give that a testing since for some reason you seem to be
the only system able to hit this and confirm that it's now working
properly. Then I'll push it upstream

And thanks for doing all the debug work to find this and identify what
was going on.

Alan