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
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:46 -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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:46 -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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:46 -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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:46 -04:00
|
|
|
|
2009-08-03 16:00:15 -07:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-10 22:40:59 -08: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
|
|
|
|
|
|
|
|
|
2019-01-21 17:26:42 +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
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-10 22:41:01 -08: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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 07:04:48 -04: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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-05 12:13:09 -05: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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-10 22:41:04 -08:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-27 14:30:21 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-15 09:14:23 -04: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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-06-01 22:53:01 +02:00
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-11-30 13:18:35 +00:00
|
|
|
|
|
|
|
|
|
2010-06-01 22:53:01 +02: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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-31 13:06:51 +03:00
|
|
|
|
2017-06-02 13:49:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-04-14 10:57:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-16 20:06:34 +09: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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2008-07-22 11:16:55 +01: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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-31 13:06:51 +03:00
|
|
|
|
2016-01-10 22:41:03 -08: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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-10 22:41:04 -08:00
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
2016-01-10 22:41:05 -08: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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-10 22:41:05 -08: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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-11 12:50:12 +01:00
|
|
|
|
|
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-10 22:41:08 -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
|
|
|
|
|
|
|
|
|
2014-11-05 12:12:58 -05:00
|
|
|
|
2008-07-22 11:16:55 +01:00
|
|
|
|
2014-11-05 12:12:58 -05:00
|
|
|
|
2016-01-10 22:41:00 -08: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
|
|
|
|
|
|
|
|
|
2009-06-29 15:21:47 +01: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
|
|
|
|
2017-05-15 18:45:33 +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
|
|
|
|
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
|
|
|
|
2016-01-09 21:13:46 -08: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
|
|
|
|
2019-01-21 17:26:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
proc/sysctl: add shared variables for range check
In the sysctl code the proc_dointvec_minmax() function is often used to
validate the user supplied value between an allowed range. This
function uses the extra1 and extra2 members from struct ctl_table as
minimum and maximum allowed value.
On sysctl handler declaration, in every source file there are some
readonly variables containing just an integer which address is assigned
to the extra1 and extra2 members, so the sysctl range is enforced.
The special values 0, 1 and INT_MAX are very often used as range
boundary, leading duplication of variables like zero=0, one=1,
int_max=INT_MAX in different source files:
$ git grep -E '\.extra[12].*&(zero|one|int_max)' |wc -l
248
Add a const int array containing the most commonly used values, some
macros to refer more easily to the correct array member, and use them
instead of creating a local one for every object file.
This is the bloat-o-meter output comparing the old and new binary
compiled with the default Fedora config:
# scripts/bloat-o-meter -d vmlinux.o.old vmlinux.o
add/remove: 2/2 grow/shrink: 0/2 up/down: 24/-188 (-164)
Data old new delta
sysctl_vals - 12 +12
__kstrtab_sysctl_vals - 12 +12
max 14 10 -4
int_max 16 - -16
one 68 - -68
zero 128 28 -100
Total: Before=20583249, After=20583085, chg -0.00%
[mcroce@redhat.com: tipc: remove two unused variables]
Link: http://lkml.kernel.org/r/20190530091952.4108-1-mcroce@redhat.com
[akpm@linux-foundation.org: fix net/ipv6/sysctl_net_ipv6.c]
[arnd@arndb.de: proc/sysctl: make firmware loader table conditional]
Link: http://lkml.kernel.org/r/20190617130014.1713870-1-arnd@arndb.de
[akpm@linux-foundation.org: fix fs/eventpoll.c]
Link: http://lkml.kernel.org/r/20190430180111.10688-1-mcroce@redhat.com
Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Aaron Tomlin <atomlin@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-07-18 15:58:50 -07:00
|
|
|
|
|
|
|
|
|
2019-01-21 17:26:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|