Re: [PATCH] tty: Fix tcdrain hang due to tty chars_in_buffer errors

From: Alan Cox
Date: Fri Jul 17 2009 - 12:00:39 EST


On Fri, 17 Jul 2009 11:07:54 -0400
Jeff Harris <jeff_harris@xxxxxxxxxxx> wrote:

> If a tty driver's chars_in_buffer callback reports an error, the wait loop in

chars_in_buffer cannot report an error. It reports how many characters
are in the buffer.

> A process calling tcdrain will block indefinitely if it calls tcdrain when the
> device is disconnected.

Fix your chars_in_buffer. On a disconnect its quite reasonable to return
0, as they are not buffered any more.

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/