<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/tty/tty_io.c, branch linux-4.13.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.13.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.13.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2017-08-24T20:23:03Z</updated>
<entry>
<title>pty: Repair TIOCGPTPEER</title>
<updated>2017-08-24T20:23:03Z</updated>
<author>
<name>Eric W. Biederman</name>
</author>
<published>2017-08-24T20:13:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=311fc65c9fb9c966bca8e6f3ff8132ce57344ab9'/>
<id>urn:sha1:311fc65c9fb9c966bca8e6f3ff8132ce57344ab9</id>
<content type='text'>
The implementation of TIOCGPTPEER has two issues.

When /dev/ptmx (as opposed to /dev/pts/ptmx) is opened the wrong
vfsmount is passed to dentry_open.  Which results in the kernel displaying
the wrong pathname for the peer.

The second is simply by caching the vfsmount and dentry of the peer it leaves
them open, in a way they were not previously Which because of the inreased
reference counts can cause unnecessary behaviour differences resulting in
regressions.

To fix these move the ioctl into tty_io.c at a generic level allowing
the ioctl to have access to the struct file on which the ioctl is
being called.  This allows the path of the slave to be derived when
opening the slave through TIOCGPTPEER instead of requiring the path to
the slave be cached.  Thus removing the need for caching the path.

A new function devpts_ptmx_path is factored out of devpts_acquire and
used to implement a function devpts_mntget.   The new function devpts_mntget
takes a filp to perform the lookup on and fsi so that it can confirm
that the superblock that is found by devpts_ptmx_path is the proper superblock.

v2: Lots of fixes to make the code actually work
v3: Suggestions by Linus
    - Removed the unnecessary initialization of filp in ptm_open_peer
    - Simplified devpts_ptmx_path as gotos are no longer required

[ This is the fix for the issue that was reverted in commit
  143c97cc6529, but this time without breaking 'pbuilder' due to
  increased reference counts   - Linus ]

Fixes: 54ebbfb16034 ("tty: add TIOCGPTPEER ioctl")
Reported-by: Christian Brauner &lt;christian.brauner@canonical.com&gt;
Reported-and-tested-by: Stefan Lippers-Hollmann &lt;s.l-h@gmx.de&gt;
Signed-off-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>tty: add function to convert device name to number</title>
<updated>2017-06-27T07:08:47Z</updated>
<author>
<name>Okash Khawaja</name>
</author>
<published>2017-06-25T18:40:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fc61ed51270e86440cf7cf84cbe1d86753592932'/>
<id>urn:sha1:fc61ed51270e86440cf7cf84cbe1d86753592932</id>
<content type='text'>
The function converts strings like ttyS0 and ttyUSB0 to dev_t like
(4, 64) and (188, 0). It does this by scanning tty_drivers list for
corresponding device name and index. If the driver is not registered,
this function returns -ENODEV. It also acquires tty_mutex.

Signed-off-by: Okash Khawaja &lt;okash.khawaja@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty: export tty_open_by_driver</title>
<updated>2017-05-16T12:04:49Z</updated>
<author>
<name>Okash Khawaja</name>
</author>
<published>2017-05-15T17:45:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=12e84c71b7d4ee38d51377fd494ac748ee4e6912'/>
<id>urn:sha1:12e84c71b7d4ee38d51377fd494ac748ee4e6912</id>
<content type='text'>
This exports tty_open_by_driver so that it can be called from other
places inside the kernel. The checks for null file pointer are based on
Alan Cox's patch here:
http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1215095.html.
Description below is quoted from it:

"[RFC] tty_port: allow a port to be opened with a tty that has no file handle

    Let us create tty objects entirely in kernel space. Untested proposal to
    show why all the ideas around rewriting half the uart stack are not needed.

    With this a kernel created non file backed tty object could be used to handle
    data, and set terminal modes. Not all ldiscs can cope with this as N_TTY in
    particular has to work back to the fs/tty layer.

    The tty_port code is however otherwise clean of file handles as far as I can
    tell as is the low level tty port write path used by the ldisc, the
    configuration low level interfaces and most of the ldiscs.

    Currently you don't have any exposure to see tty hangups because those are
    built around the file layer. However a) it's a fixed port so you probably
    don't care about that b) if you do we can add a callback and c) you almost
    certainly don't want the userspace tear down/rebuild behaviour anyway.

    This should however be sufficient if we wanted for example to enumerate all
    the bluetooth bound fixed ports via ACPI and make them directly available.

    It doesn't deal with the case of a user opening a port that's also kernel
    opened and that would need some locking out (so it returned EBUSY if bound
    to a kernel device of some kind). That needs resolving along with how you
    "up" or "down" your new bluetooth device, or enumerate it while providing
    the existing tty API to avoid regressions (and to debug)."

The exported funtion is used later in this patch set to gain access to tty_struct.

[changed export symbol level - gkh]

Signed-off-by: Okash Khawaja &lt;okash.khawaja@gmail.com&gt;
Reviewed-by: Samuel Thibault &lt;samuel.thibault@ens-lyon.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty: split job control support into a file of its own</title>
<updated>2017-04-18T16:01:52Z</updated>
<author>
<name>Nicolas Pitre</name>
</author>
<published>2017-04-12T22:37:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a1235b3eb10086b8420f37bbb6c29436f55940ba'/>
<id>urn:sha1:a1235b3eb10086b8420f37bbb6c29436f55940ba</id>
<content type='text'>
This makes it easier for job control to become optional and/or usable
independently from tty_io.c, as well as providing a nice purpose
separation. No logical changes from this patch.

Signed-off-by: Nicolas Pitre &lt;nico@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>console: move console_init() out of tty_io.c</title>
<updated>2017-04-18T16:01:52Z</updated>
<author>
<name>Nicolas Pitre</name>
</author>
<published>2017-04-12T22:37:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0c688614dcce84dfdbb305fd1c399c06cecea745'/>
<id>urn:sha1:0c688614dcce84dfdbb305fd1c399c06cecea745</id>
<content type='text'>
All the console driver handling code lives in printk.c.
Move console_init() there as well so console support can still be used
when the TTY code is configured out. No logical changes from this patch.

Signed-off-by: Nicolas Pitre &lt;nico@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty: fix comment typo s/repsonsible/responsible/</title>
<updated>2017-04-08T16:54:07Z</updated>
<author>
<name>Thadeu Lima de Souza Cascardo</name>
</author>
<published>2017-04-04T08:56:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=87838ae3affaa96f2cfc8c1147973de42e116b80'/>
<id>urn:sha1:87838ae3affaa96f2cfc8c1147973de42e116b80</id>
<content type='text'>
Signed-off-by: Thadeu Lima de Souza Cascardo &lt;cascardo@cascardo.eti.br&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty: reset termios state on device registration</title>
<updated>2017-03-31T09:37:13Z</updated>
<author>
<name>Johan Hovold</name>
</author>
<published>2017-03-30T13:39:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=93857edd9829e144acb6c7e72d593f6e01aead66'/>
<id>urn:sha1:93857edd9829e144acb6c7e72d593f6e01aead66</id>
<content type='text'>
Free any saved termios data when registering a tty device so that the
termios state is reset when reusing a minor number.

This is useful for hot-pluggable buses such as USB where it does not
make much sense to reuse saved termios data from an unrelated device
when a new device is later plugged in.

This specifically avoids a situation where the new device does not have
the carrier-detect signal wired, but the saved termios state has CLOCAL
cleared, effectively preventing the port from being opened in blocking
mode as noted by Jan Kundrát &lt;jan.kundrat@cesnet.cz&gt;.

Note that clearing the saved data at deregistration would not work as
the device could still be open.

Also note that the termios data is not reset for drivers with
TTY_DRIVER_DYNAMIC_ALLOC set (e.g. legacy pty) as their character device
is registered at driver registration and could theoretically already
have been opened (and pty termios state is never saved anyway).

Reported-by: Jan Kundrát &lt;jan.kundrat@cesnet.cz&gt;
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty: drop obsolete termios_locked comments</title>
<updated>2017-03-31T09:37:13Z</updated>
<author>
<name>Johan Hovold</name>
</author>
<published>2017-03-30T13:39:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=16b00ae82dce0e36384744553c6e9e97070813e8'/>
<id>urn:sha1:16b00ae82dce0e36384744553c6e9e97070813e8</id>
<content type='text'>
Drop comments about tty-driver termios_locked structures, which have
been outdated since commit fe6e29fdb1a7 ("tty: simplify ktermios
allocation").

Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty: close race between device register and open</title>
<updated>2017-03-31T09:37:13Z</updated>
<author>
<name>Johan Hovold</name>
</author>
<published>2017-03-30T13:39:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6a7e6f78c235975cc14d4e141fa088afffe7062c'/>
<id>urn:sha1:6a7e6f78c235975cc14d4e141fa088afffe7062c</id>
<content type='text'>
The tty class device is currently not registered until after the
character device has been registered thereby leaving a small window
were a racing open could end up with a NULL tty-&gt;dev pointer due to the
class-device lookup failing in alloc_tty_struct.

Close this race by registering the class device before the character
device while making sure to defer the user-space uevent notification
until after the character device has been registered.

Note that some tty drivers expect a valid tty-&gt;dev and would misbehave
or crash otherwise. Some line disciplines also currently dereference the
class device unconditionally despite the fact that not every tty is
guaranteed to have one (Unix98 pty), but this is being fixed separately.

Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>drivers/tty: Convert remaining uses of pr_warning to pr_warn</title>
<updated>2017-03-17T05:14:00Z</updated>
<author>
<name>Joe Perches</name>
</author>
<published>2017-02-17T07:11:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d437fa9109bab8b83a9427d48bebff6c3e053010'/>
<id>urn:sha1:d437fa9109bab8b83a9427d48bebff6c3e053010</id>
<content type='text'>
To enable eventual removal of pr_warning

This makes pr_warn use consistent for drivers/tty

Prior to this patch, there were 2 uses of pr_warning and
23 uses of pr_warn in drivers/tty

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
