<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/tty/tty_io.c, branch v4.9</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.9</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.9'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2016-05-09T07:39:13Z</updated>
<entry>
<title>Merge 4.6-rc7 into tty-next</title>
<updated>2016-05-09T07:39:13Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2016-05-09T07:39:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=10ee08292028d3d22d201a34ba7d24a085818cb3'/>
<id>urn:sha1:10ee08292028d3d22d201a34ba7d24a085818cb3</id>
<content type='text'>
We want the pty fixes in here as well so that patches can build on it.

Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty: Remove stale parameter comment</title>
<updated>2016-04-30T16:26:55Z</updated>
<author>
<name>Peter Hurley</name>
<email>peter@hurleysoftware.com</email>
</author>
<published>2016-04-10T03:36:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=25f3ecc28b431d6befcea0a4bafe8fe74c5a3988'/>
<id>urn:sha1:25f3ecc28b431d6befcea0a4bafe8fe74c5a3988</id>
<content type='text'>
noctty was removed as a parameter by commit 11e1d4aa4da
("tty: Consolidate noctty check in tty_open()").

Signed-off-by: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty: Remove unused TTY_NUMBER() macro</title>
<updated>2016-04-30T16:26:55Z</updated>
<author>
<name>Peter Hurley</name>
<email>peter@hurleysoftware.com</email>
</author>
<published>2016-04-10T03:36:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0f0380b6177ab628b9e7c5a566dcdb3889e38dcb'/>
<id>urn:sha1:0f0380b6177ab628b9e7c5a566dcdb3889e38dcb</id>
<content type='text'>
TTY_NUMBER() has been unused since v2.5.71; removed by
"[PATCH] callout removal: callout is gone".

Signed-off-by: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty: Replace TTY_IO_ERROR bit tests with tty_io_error()</title>
<updated>2016-04-30T16:26:55Z</updated>
<author>
<name>Peter Hurley</name>
<email>peter@hurleysoftware.com</email>
</author>
<published>2016-04-10T00:06:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=18900ca65a8553edc608b6c9d518eb31e6c09ba1'/>
<id>urn:sha1:18900ca65a8553edc608b6c9d518eb31e6c09ba1</id>
<content type='text'>
Abstract TTY_IO_ERROR status test treewide with tty_io_error().
NB: tty-&gt;flags uses atomic bit ops; replace non-atomic bit test
with test_bit().

Signed-off-by: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>devpts: more pty driver interface cleanups</title>
<updated>2016-04-26T22:47:32Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2016-04-26T03:04:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8ead9dd54716d1e05e129959f702fcc1786f82b4'/>
<id>urn:sha1:8ead9dd54716d1e05e129959f702fcc1786f82b4</id>
<content type='text'>
This is more prep-work for the upcoming pty changes.  Still just code
cleanup with no actual semantic changes.

This removes a bunch pointless complexity by just having the slave pty
side remember the dentry associated with the devpts slave rather than
the inode.  That allows us to remove all the "look up the dentry" code
for when we want to remove it again.

Together with moving the tty pointer from "inode-&gt;i_private" to
"dentry-&gt;d_fsdata" and getting rid of pointless inode locking, this
removes about 30 lines of code.  Not only is the end result smaller,
it's simpler and easier to understand.

The old code, for example, depended on the d_find_alias() to not just
find the dentry, but also to check that it is still hashed, which in
turn validated the tty pointer in the inode.

That is a _very_ roundabout way to say "invalidate the cached tty
pointer when the dentry is removed".

The new code just does

	dentry-&gt;d_fsdata = NULL;

in devpts_pty_kill() instead, invalidating the tty pointer rather more
directly and obviously.  Don't do something complex and subtle when the
obvious straightforward approach will do.

The rest of the patch (ie apart from code deletion and the above tty
pointer clearing) is just switching the calling convention to pass the
dentry or file pointer around instead of the inode.

Cc: Eric Biederman &lt;ebiederm@xmission.com&gt;
Cc: Peter Anvin &lt;hpa@zytor.com&gt;
Cc: Andy Lutomirski &lt;luto@amacapital.net&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Cc: Serge Hallyn &lt;serge.hallyn@ubuntu.com&gt;
Cc: Willy Tarreau &lt;w@1wt.eu&gt;
Cc: Aurelien Jarno &lt;aurelien@aurel32.net&gt;
Cc: Alan Cox &lt;gnomes@lxorguk.ukuu.org.uk&gt;
Cc: Jann Horn &lt;jann@thejh.net&gt;
Cc: Greg KH &lt;greg@kroah.com&gt;
Cc: Jiri Slaby &lt;jslaby@suse.com&gt;
Cc: Florian Weimer &lt;fw@deneb.enyo.de&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>tty: Fix merge of "tty: Refactor tty_open()"</title>
<updated>2016-04-01T03:49:39Z</updated>
<author>
<name>Peter Hurley</name>
<email>peter@hurleysoftware.com</email>
</author>
<published>2016-04-01T00:47:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5e00bbfbc5ec21e87d24e206bba9fc2cbe6631a1'/>
<id>urn:sha1:5e00bbfbc5ec21e87d24e206bba9fc2cbe6631a1</id>
<content type='text'>
Commit e9036d066236 ("tty: Drop krefs for interrupted tty lock")
fixed a tty reference counting problem introduced in
commit 0bfd464d3fdd ("tty: Wait interruptibly for tty lock on reopen"),
so v4.5.0 is correct.

However, commit d6203d0c7b73 ("tty: Refactor tty_open()") moved the
relevant code for 4.6-rc1; correct the merge.

Signed-off-by: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty: Fix UML console breakage</title>
<updated>2016-04-01T00:14:14Z</updated>
<author>
<name>Peter Hurley</name>
<email>peter@hurleysoftware.com</email>
</author>
<published>2016-04-01T00:05:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=da5a0fc6743df9b5a3e9f915a1ed16f45465d529'/>
<id>urn:sha1:da5a0fc6743df9b5a3e9f915a1ed16f45465d529</id>
<content type='text'>
User-Mode Linux supplies an alternate TTY_MAJOR driver for stdio console,
so the noctty check in tty_open() must apply only to VT driver tty0
devnode and not the UML console driver tty0 devnode.

Fixes: 11e1d4aa4da1 ("tty: Consolidate noctty checks in tty_open()")
Reported-by: Richard Weinberger &lt;richard.weinberger@gmail.com&gt;
Signed-off-by: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty: Fix ioctl(FIOASYNC) on hungup file</title>
<updated>2016-01-28T19:58:02Z</updated>
<author>
<name>Peter Hurley</name>
<email>peter@hurleysoftware.com</email>
</author>
<published>2016-01-10T05:45:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a8f3a29718f77df3116955d100756f67fafabec0'/>
<id>urn:sha1:a8f3a29718f77df3116955d100756f67fafabec0</id>
<content type='text'>
A small race window exists which allows signal-driven async i/o to be
enabled for the tty when the file ptr has already been hungup and
signal-driven i/o has been disabled:

CPU 0                                CPU 1
-----                                ------
ioctl_fioasync(on)
  filp-&gt;f_op-&gt;fasync(on)             __tty_hangup()
    tty_fasync(on)                     tty_lock()
      tty_lock()                       ...
        .                              filp-&gt;f_op = &amp;hung_up_tty_fops;
      (waiting)                       __tty_fasync(off)
        .                              tty_unlock()
      /* gets tty lock  */
      /* enables FASYNC */

Check the tty has not been hungup while holding tty_lock.

Signed-off-by: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty: Add fasync() hung up file operation</title>
<updated>2016-01-28T19:58:02Z</updated>
<author>
<name>Peter Hurley</name>
<email>peter@hurleysoftware.com</email>
</author>
<published>2016-01-10T05:45:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f557474ca3a23800dffb790846bcb121fa046c71'/>
<id>urn:sha1:f557474ca3a23800dffb790846bcb121fa046c71</id>
<content type='text'>
VFS uses a two-stage check-and-call method for invoking file_operations
methods, without explicitly snapshotting either the file_operations ptr
or the function ptr. Since the tty core is one of the few VFS users that
changes the f_op file_operations ptr of the file descriptor (when the
tty has been hung up), and since the likelihood of the compiler generating
a reload of either f_op or the function ptr is basically nil, just define
a hung up fasync() file operation that returns an error.

Signed-off-by: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty, n_tty: Remove fasync() ldisc notification</title>
<updated>2016-01-28T19:58:02Z</updated>
<author>
<name>Peter Hurley</name>
<email>peter@hurleysoftware.com</email>
</author>
<published>2016-01-10T05:45:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bee6741ca022f051ea1b46e16fb2ff0097643181'/>
<id>urn:sha1:bee6741ca022f051ea1b46e16fb2ff0097643181</id>
<content type='text'>
Only the N_TTY line discipline implements the signal-driven i/o
notification enabled/disabled by fcntl(F_SETFL, O_ASYNC). The ldisc
fasync() notification is sent to the ldisc when the enable state has
changed (the tty core is notified via the fasync() VFS file operation).

The N_TTY line discipline used the enable state to change the wakeup
condition (minimum_to_wake = 1) for notifying the signal handler i/o is
available. However, just the presence of data is sufficient and necessary
to signal i/o is available, so changing minimum_to_wake is unnecessary
(and creates a race condition with read() and poll() which may be
concurrently updating minimum_to_wake).

Furthermore, since the kill_fasync() VFS helper performs no action if
the fasync list is empty, calling unconditionally is preferred; if
signal driven i/o just has been disabled, no signal will be sent by
kill_fasync() anyway so notification of the change via the ldisc
fasync() method is superfluous.

Signed-off-by: Peter Hurley &lt;peter@hurleysoftware.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
