Re: [PATCH] tty: fix flush_to_ldisc() oops before tty_open is done

From: Alan Cox
Date: Thu Oct 26 2017 - 10:32:16 EST


> I can reproduce this problem on CentOS now. It seems better to leave this problem to drivers, not the user process.
> Do you think we should examine serial drivers of ARM, like pl011?

Can you reproduce it on real hardware - I ask because the driver has been
around for years without reports and it would be good to know it's not a
virtual platform problem you are chasing.

> ---------------------------------------------------------------------------------------
> Does it means this serial driver do not support activate/deactive? Is that out of date?
> Because tty driver is complex, I am studying the concept and source code, and need time to find a good solution.

AMBA uses the uart layer. So uart does a lot of the work.

Yes the driver is complex and the core hangup/receive paths are tricky to
understand. The open path however is fairly simple so the fact you see a
failure there makes me suspicious and I tink that is the first one to
trace because the tty_open paths do not set port->tty until the tty is
initialized properly.

The hangup path is complex and has a history of bugs and races so is a
bit less surprising.

The important detail here is that both the queueing of data and the
hangup are done by schedule_work() and as far as I can see (the code
has changed somewhat since I last dug into that bit) rely on that to avoid
the two executing at the same time.

Alan