Re: [PATCH net] drivers/net/wan/x25_asy: Keep the ldisc running even when netif is down

From: David Miller
Date: Mon Sep 28 2020 - 19:18:48 EST


From: Xie He <xie.he.0141@xxxxxxxxx>
Date: Sat, 26 Sep 2020 13:56:10 -0700

> @@ -265,7 +269,9 @@ static void x25_asy_write_wakeup(struct tty_struct *tty)
> * transmission of another packet */
> sl->dev->stats.tx_packets++;
> clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
> - x25_asy_unlock(sl);
> + /* FIXME: The netif may go down after netif_running returns */
> + if (netif_running(sl->dev))
> + x25_asy_unlock(sl);
> return;

It could also go back down and also back up again after you do this
test. Maybe even 10 or 100 times over.

You can't just leave things so incredibly racy like this, please apply
proper synchronization between netdev state changes and this TTY code.

Thank you.