2017-11-06 18:11:51 +01:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
2011-11-16 16:27:10 +01:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-16 16:27:09 +01:00
|
|
|
|
2021-04-08 14:51:22 +02:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2013-03-11 16:44:38 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-07-12 22:49:10 -04:00
|
|
|
|
2013-03-11 16:44:38 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:46 -04:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-05-05 11:19:07 +02:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-05 11:19:07 +02:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:46 -04:00
|
|
|
|
2021-05-05 11:19:07 +02:00
|
|
|
|
2013-06-15 07:04:46 -04:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2023-02-23 04:23:03 +08:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
2021-05-05 11:19:12 +02:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:46 -04:00
|
|
|
|
2021-05-05 11:19:10 +02:00
|
|
|
|
2013-06-15 07:04:46 -04:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-03 16:00:15 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:46 -04:00
|
|
|
|
2009-08-03 16:00:15 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-05 11:19:10 +02:00
|
|
|
|
2009-08-03 16:00:15 -07:00
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:46 -04:00
|
|
|
|
2009-08-03 16:00:15 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:46 -04:00
|
|
|
|
2009-08-03 16:00:15 -07:00
|
|
|
|
2013-06-15 07:04:46 -04:00
|
|
|
|
2009-08-03 16:00:15 -07:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2022-10-22 11:29:48 -07:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:48 -04:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2009-08-03 16:01:28 -07:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2009-08-03 16:01:28 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-21 17:26:42 +01:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2009-08-03 16:01:28 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2009-08-03 16:01:28 -07:00
|
|
|
|
2018-04-25 20:12:31 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-03 16:01:28 -07:00
|
|
|
|
2013-06-15 07:04:48 -04:00
|
|
|
|
2012-05-03 14:37:43 +02:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-03-11 16:44:43 -04:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
2013-03-11 16:44:43 -04:00
|
|
|
|
2015-10-27 17:40:02 +01:00
|
|
|
|
2013-03-11 16:44:43 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:48 -04:00
|
|
|
|
2013-03-11 16:44:43 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-11 12:51:41 +01:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-11 12:51:41 +01:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-03 16:00:15 -07:00
|
|
|
|
2009-06-11 12:51:41 +01:00
|
|
|
|
2009-08-03 16:00:15 -07:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2009-08-03 16:00:15 -07:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-13 19:44:18 +02:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
tty: Destroy ldisc instance on hangup
Currently, when the tty is hungup, the ldisc is re-instanced; ie., the
current instance is destroyed and a new instance is created. The purpose
of this design was to guarantee a valid, open ldisc for the lifetime of
the tty.
However, now that tty buffers are owned by and have lifetime equivalent
to the tty_port (since v3.10), any data received immediately after the
ldisc is re-instanced may cause continued driver i/o operations
concurrently with the driver's hangup() operation. For drivers that
shutdown h/w on hangup, this is unexpected and usually bad. For example,
the serial core may free the xmit buffer page concurrently with an
in-progress write() operation (triggered by echo).
With the existing stable and robust ldisc reference handling, the
cleaned-up tty_reopen(), the straggling unsafe ldisc use cleaned up, and
the preparation to properly handle a NULL tty->ldisc, the ldisc instance
can be destroyed and only re-instanced when the tty is re-opened.
If the tty was opened as /dev/console or /dev/tty0, the original behavior
of re-instancing the ldisc is retained (the 'reinit' parameter to
tty_ldisc_hangup() is true). This is required since those file descriptors
are never hungup.
This patch has neglible impact on userspace; the tty file_operations ptr
is changed to point to the hungup file operations _before_ the ldisc
instance is destroyed, so only racing file operations might now retrieve
a NULL ldisc reference (which is simply handled as if the hungup file
operation had been called instead -- see "tty: Prepare for destroying
line discipline on hangup").
This resolves a long-standing FIXME and several crash reports.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-10 22:41:06 -08:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-04 13:46:12 +01:00
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:48 -04:00
|
|
|
|
2017-03-04 13:46:12 +01:00
|
|
|
|
|
|
|
|
|
2016-01-10 22:41:02 -08:00
|
|
|
|
2017-03-04 13:46:12 +01:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:48 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:48 -04:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:47 -04:00
|
|
|
|
2016-01-09 21:13:51 -08:00
|
|
|
|
2014-11-05 12:13:06 -05:00
|
|
|
|
2013-06-15 07:04:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-09 21:13:51 -08:00
|
|
|
|
2014-11-05 12:13:06 -05:00
|
|
|
|
2013-06-15 07:04:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-05 12:13:06 -05:00
|
|
|
|
2013-06-15 07:04:47 -04:00
|
|
|
|
2015-10-04 21:19:18 +02:00
|
|
|
|
2013-06-15 07:04:47 -04:00
|
|
|
|
|
|
|
|
|
2018-01-23 13:16:34 +05:30
|
|
|
|
2014-11-05 12:13:07 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-01 00:24:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-05 12:13:07 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-01-23 13:16:34 +05:30
|
|
|
|
2014-11-05 12:13:07 -05:00
|
|
|
|
|
|
|
|
|
2018-11-01 00:24:48 +00:00
|
|
|
|
|
|
|
|
|
2014-11-05 12:13:07 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-09 21:13:51 -08:00
|
|
|
|
2013-06-15 07:04:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-05 12:13:06 -05:00
|
|
|
|
2013-06-15 07:04:47 -04:00
|
|
|
|
2014-11-05 12:13:06 -05:00
|
|
|
|
2013-06-15 07:04:47 -04:00
|
|
|
|
2014-11-05 12:13:06 -05:00
|
|
|
|
2013-06-15 07:04:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-05 12:13:06 -05:00
|
|
|
|
2013-06-15 07:04:47 -04:00
|
|
|
|
2014-11-05 12:13:06 -05:00
|
|
|
|
2013-06-15 07:04:47 -04:00
|
|
|
|
2014-11-05 12:13:06 -05:00
|
|
|
|
2013-06-15 07:04:47 -04:00
|
|
|
|
|
|
|
|
|
2014-11-05 12:13:06 -05:00
|
|
|
|
2013-06-15 07:04:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-09 21:13:51 -08:00
|
|
|
|
2013-06-15 07:04:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-09 21:13:51 -08:00
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:47 -04:00
|
|
|
|
2014-11-05 12:13:06 -05:00
|
|
|
|
2013-06-15 07:04:47 -04:00
|
|
|
|
2014-11-05 12:13:06 -05:00
|
|
|
|
2013-06-15 07:04:47 -04:00
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:58 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:58 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-05 12:13:09 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2015-11-27 14:30:21 -05:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2016-01-10 22:41:04 -08:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2013-06-15 09:14:23 -04:00
|
|
|
|
2016-01-10 22:41:04 -08:00
|
|
|
|
2013-06-15 09:14:23 -04:00
|
|
|
|
2015-11-27 14:30:21 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
2010-06-01 22:53:01 +02:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-11-30 13:18:35 +00:00
|
|
|
|
|
|
|
|
|
2021-04-07 15:06:46 +08:00
|
|
|
|
2009-11-30 13:18:35 +00:00
|
|
|
|
2010-11-25 00:27:54 +01:00
|
|
|
|
|
|
|
|
|
2015-07-12 22:49:12 -04:00
|
|
|
|
2016-01-10 22:41:02 -08:00
|
|
|
|
2009-11-30 13:18:35 +00:00
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-31 13:06:51 +03:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-10 22:41:02 -08:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2017-06-02 13:49:30 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-02 13:49:30 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2017-06-02 13:49:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-31 13:06:51 +03:00
|
|
|
|
2017-06-02 13:49:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-04-07 15:06:49 +08:00
|
|
|
|
|
|
|
|
|
2017-06-02 13:49:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-04-14 10:57:52 +02:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-04-14 10:57:52 +02:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2017-04-14 10:57:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-16 20:06:34 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-04-07 15:06:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-02 13:49:30 +01:00
|
|
|
|
|
|
|
|
|
2018-04-16 20:06:34 +09:00
|
|
|
|
2017-04-14 10:57:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2016-01-10 22:41:04 -08:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2017-04-14 10:57:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2014-11-05 12:12:45 -05:00
|
|
|
|
2014-11-05 12:13:08 -05:00
|
|
|
|
2015-11-08 09:29:38 -05:00
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2016-01-10 22:41:02 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-08 09:29:38 -05:00
|
|
|
|
2017-04-14 10:57:52 +02:00
|
|
|
|
2015-11-08 09:29:38 -05:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2015-11-08 09:29:38 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2024-04-23 09:33:39 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-04-14 10:57:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2017-04-14 10:57:52 +02:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2017-04-14 10:57:52 +02:00
|
|
|
|
2014-11-05 13:11:41 -05:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2014-11-05 13:11:41 -05:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-04-07 15:06:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-04-14 10:57:52 +02:00
|
|
|
|
2015-11-08 09:29:38 -05:00
|
|
|
|
2014-11-05 12:13:08 -05:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-04-07 15:06:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-08 07:53:06 -05:00
|
|
|
|
2015-11-08 09:29:38 -05:00
|
|
|
|
2017-04-14 10:57:52 +02:00
|
|
|
|
2012-08-08 16:30:13 +01:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
2017-05-15 18:45:33 +01:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2016-01-10 22:41:03 -08:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2016-01-10 22:41:03 -08:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
2016-01-10 22:41:03 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-31 13:06:51 +03:00
|
|
|
|
2016-01-10 22:41:03 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 09:14:23 -04:00
|
|
|
|
2012-07-14 15:31:47 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 09:14:23 -04:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-10 22:41:05 -08:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
tty: Destroy ldisc instance on hangup
Currently, when the tty is hungup, the ldisc is re-instanced; ie., the
current instance is destroyed and a new instance is created. The purpose
of this design was to guarantee a valid, open ldisc for the lifetime of
the tty.
However, now that tty buffers are owned by and have lifetime equivalent
to the tty_port (since v3.10), any data received immediately after the
ldisc is re-instanced may cause continued driver i/o operations
concurrently with the driver's hangup() operation. For drivers that
shutdown h/w on hangup, this is unexpected and usually bad. For example,
the serial core may free the xmit buffer page concurrently with an
in-progress write() operation (triggered by echo).
With the existing stable and robust ldisc reference handling, the
cleaned-up tty_reopen(), the straggling unsafe ldisc use cleaned up, and
the preparation to properly handle a NULL tty->ldisc, the ldisc instance
can be destroyed and only re-instanced when the tty is re-opened.
If the tty was opened as /dev/console or /dev/tty0, the original behavior
of re-instancing the ldisc is retained (the 'reinit' parameter to
tty_ldisc_hangup() is true). This is required since those file descriptors
are never hungup.
This patch has neglible impact on userspace; the tty file_operations ptr
is changed to point to the hungup file operations _before_ the ldisc
instance is destroyed, so only racing file operations might now retrieve
a NULL ldisc reference (which is simply handled as if the hungup file
operation had been called instead -- see "tty: Prepare for destroying
line discipline on hangup").
This resolves a long-standing FIXME and several crash reports.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-10 22:41:06 -08:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2016-01-10 22:41:05 -08:00
|
|
|
|
|
|
|
|
|
2010-10-27 17:13:21 +02:00
|
|
|
|
2019-05-31 13:06:51 +03:00
|
|
|
|
2016-01-10 22:41:05 -08:00
|
|
|
|
2017-04-14 10:57:52 +02:00
|
|
|
|
|
|
|
|
|
2016-01-10 22:41:05 -08:00
|
|
|
|
2017-04-14 10:57:52 +02:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2016-01-10 22:41:05 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-03-11 16:44:42 -04:00
|
|
|
|
2016-01-10 22:41:04 -08:00
|
|
|
|
2016-01-10 22:41:05 -08:00
|
|
|
|
|
|
|
|
|
2017-10-13 15:58:08 -07:00
|
|
|
|
|
|
|
|
|
2016-01-10 22:41:05 -08:00
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
tty: Destroy ldisc instance on hangup
Currently, when the tty is hungup, the ldisc is re-instanced; ie., the
current instance is destroyed and a new instance is created. The purpose
of this design was to guarantee a valid, open ldisc for the lifetime of
the tty.
However, now that tty buffers are owned by and have lifetime equivalent
to the tty_port (since v3.10), any data received immediately after the
ldisc is re-instanced may cause continued driver i/o operations
concurrently with the driver's hangup() operation. For drivers that
shutdown h/w on hangup, this is unexpected and usually bad. For example,
the serial core may free the xmit buffer page concurrently with an
in-progress write() operation (triggered by echo).
With the existing stable and robust ldisc reference handling, the
cleaned-up tty_reopen(), the straggling unsafe ldisc use cleaned up, and
the preparation to properly handle a NULL tty->ldisc, the ldisc instance
can be destroyed and only re-instanced when the tty is re-opened.
If the tty was opened as /dev/console or /dev/tty0, the original behavior
of re-instancing the ldisc is retained (the 'reinit' parameter to
tty_ldisc_hangup() is true). This is required since those file descriptors
are never hungup.
This patch has neglible impact on userspace; the tty file_operations ptr
is changed to point to the hungup file operations _before_ the ldisc
instance is destroyed, so only racing file operations might now retrieve
a NULL ldisc reference (which is simply handled as if the hungup file
operation had been called instead -- see "tty: Prepare for destroying
line discipline on hangup").
This resolves a long-standing FIXME and several crash reports.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-10 22:41:06 -08:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-10 22:41:02 -08:00
|
|
|
|
2013-03-11 16:44:38 -04:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:48 -04:00
|
|
|
|
2018-02-11 14:34:03 -08:00
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:48 -04:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
|
|
|
|
|
2010-02-08 10:09:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2014-11-05 12:13:07 -05:00
|
|
|
|
2010-06-01 22:53:06 +02:00
|
|
|
|
tty: Destroy ldisc instance on hangup
Currently, when the tty is hungup, the ldisc is re-instanced; ie., the
current instance is destroyed and a new instance is created. The purpose
of this design was to guarantee a valid, open ldisc for the lifetime of
the tty.
However, now that tty buffers are owned by and have lifetime equivalent
to the tty_port (since v3.10), any data received immediately after the
ldisc is re-instanced may cause continued driver i/o operations
concurrently with the driver's hangup() operation. For drivers that
shutdown h/w on hangup, this is unexpected and usually bad. For example,
the serial core may free the xmit buffer page concurrently with an
in-progress write() operation (triggered by echo).
With the existing stable and robust ldisc reference handling, the
cleaned-up tty_reopen(), the straggling unsafe ldisc use cleaned up, and
the preparation to properly handle a NULL tty->ldisc, the ldisc instance
can be destroyed and only re-instanced when the tty is re-opened.
If the tty was opened as /dev/console or /dev/tty0, the original behavior
of re-instancing the ldisc is retained (the 'reinit' parameter to
tty_ldisc_hangup() is true). This is required since those file descriptors
are never hungup.
This patch has neglible impact on userspace; the tty file_operations ptr
is changed to point to the hungup file operations _before_ the ldisc
instance is destroyed, so only racing file operations might now retrieve
a NULL ldisc reference (which is simply handled as if the hungup file
operation had been called instead -- see "tty: Prepare for destroying
line discipline on hangup").
This resolves a long-standing FIXME and several crash reports.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-10 22:41:06 -08:00
|
|
|
|
2010-02-08 10:09:26 +00:00
|
|
|
|
2013-03-11 16:44:38 -04:00
|
|
|
|
tty: Destroy ldisc instance on hangup
Currently, when the tty is hungup, the ldisc is re-instanced; ie., the
current instance is destroyed and a new instance is created. The purpose
of this design was to guarantee a valid, open ldisc for the lifetime of
the tty.
However, now that tty buffers are owned by and have lifetime equivalent
to the tty_port (since v3.10), any data received immediately after the
ldisc is re-instanced may cause continued driver i/o operations
concurrently with the driver's hangup() operation. For drivers that
shutdown h/w on hangup, this is unexpected and usually bad. For example,
the serial core may free the xmit buffer page concurrently with an
in-progress write() operation (triggered by echo).
With the existing stable and robust ldisc reference handling, the
cleaned-up tty_reopen(), the straggling unsafe ldisc use cleaned up, and
the preparation to properly handle a NULL tty->ldisc, the ldisc instance
can be destroyed and only re-instanced when the tty is re-opened.
If the tty was opened as /dev/console or /dev/tty0, the original behavior
of re-instancing the ldisc is retained (the 'reinit' parameter to
tty_ldisc_hangup() is true). This is required since those file descriptors
are never hungup.
This patch has neglible impact on userspace; the tty file_operations ptr
is changed to point to the hungup file operations _before_ the ldisc
instance is destroyed, so only racing file operations might now retrieve
a NULL ldisc reference (which is simply handled as if the hungup file
operation had been called instead -- see "tty: Prepare for destroying
line discipline on hangup").
This resolves a long-standing FIXME and several crash reports.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-10 22:41:06 -08:00
|
|
|
|
|
|
|
|
|
2017-10-13 15:58:08 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tty: Destroy ldisc instance on hangup
Currently, when the tty is hungup, the ldisc is re-instanced; ie., the
current instance is destroyed and a new instance is created. The purpose
of this design was to guarantee a valid, open ldisc for the lifetime of
the tty.
However, now that tty buffers are owned by and have lifetime equivalent
to the tty_port (since v3.10), any data received immediately after the
ldisc is re-instanced may cause continued driver i/o operations
concurrently with the driver's hangup() operation. For drivers that
shutdown h/w on hangup, this is unexpected and usually bad. For example,
the serial core may free the xmit buffer page concurrently with an
in-progress write() operation (triggered by echo).
With the existing stable and robust ldisc reference handling, the
cleaned-up tty_reopen(), the straggling unsafe ldisc use cleaned up, and
the preparation to properly handle a NULL tty->ldisc, the ldisc instance
can be destroyed and only re-instanced when the tty is re-opened.
If the tty was opened as /dev/console or /dev/tty0, the original behavior
of re-instancing the ldisc is retained (the 'reinit' parameter to
tty_ldisc_hangup() is true). This is required since those file descriptors
are never hungup.
This patch has neglible impact on userspace; the tty file_operations ptr
is changed to point to the hungup file operations _before_ the ldisc
instance is destroyed, so only racing file operations might now retrieve
a NULL ldisc reference (which is simply handled as if the hungup file
operation had been called instead -- see "tty: Prepare for destroying
line discipline on hangup").
This resolves a long-standing FIXME and several crash reports.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-10 22:41:06 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-10 22:41:08 -08:00
|
|
|
|
2021-04-07 15:06:47 +08:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-01 00:24:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2016-01-10 22:41:08 -08:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-08 16:30:13 +01:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2014-11-05 12:12:58 -05:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2014-11-05 12:12:58 -05:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2013-03-11 16:44:35 -04:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:48 -04:00
|
|
|
|
2012-08-08 16:30:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:48 -04:00
|
|
|
|
|
|
|
|
|
2021-04-07 15:06:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-03-11 16:44:38 -04:00
|
|
|
|
2015-07-12 22:49:12 -04:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2018-04-05 19:40:16 +09:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2013-06-15 07:04:48 -04:00
|
|
|
|
2021-04-07 15:06:47 +08:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2018-04-05 19:40:16 +09:00
|
|
|
|
2013-03-11 16:44:42 -04:00
|
|
|
|
2018-04-05 19:40:16 +09:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
2011-03-23 10:48:35 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2011-03-23 10:48:35 +01:00
|
|
|
|
2021-11-26 09:16:01 +01:00
|
|
|
|
|
|
|
|
|
2011-03-23 10:48:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-01 00:24:51 +00:00
|
|
|
|
2016-01-09 21:13:46 -08:00
|
|
|
|
|
|
|
|
|
2013-03-11 16:44:42 -04:00
|
|
|
|
2011-03-23 10:48:35 +01:00
|
|
|
|