WSL2-Linux-Kernel/drivers/tty
Eric W. Biederman 311fc65c9f pty: Repair TIOCGPTPEER
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
  143c97cc65, but this time without breaking 'pbuilder' due to
  increased reference counts   - Linus ]

Fixes: 54ebbfb160 ("tty: add TIOCGPTPEER ioctl")
Reported-by: Christian Brauner <christian.brauner@canonical.com>
Reported-and-tested-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-08-24 13:23:03 -07:00
..
hvc driver core patches for 4.13-rc1 2017-07-03 20:27:48 -07:00
ipwireless networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
serdev driver core patches for 4.13-rc1 2017-07-03 20:27:48 -07:00
serial tty/serial fixes for 4.13-rc5 2017-08-13 12:33:35 -07:00
vt vt: fix \e[2m using the wrong placeholder color on graphical consoles 2017-06-09 11:20:08 +02:00
Kconfig devpts: Make each mount of devpts an independent filesystem. 2016-06-05 10:36:01 -07:00
Makefile tty: handle the case where we cannot restore a line discipline 2017-06-03 18:43:46 +09:00
amiserial.c tty: amiserial: drop broken alt-speed support 2017-06-13 11:49:58 +02:00
bfin_jtag_comm.c
cyclades.c tty: cyclades: drop broken alt-speed support 2017-06-13 11:49:58 +02:00
ehv_bytechan.c tty: ehv_bytechan: clean up init error handling 2017-05-18 16:43:55 +02:00
goldfish.c tty: goldfish: Fix a parameter of a call to free_irq 2017-01-12 11:51:25 +01:00
isicom.c
metag_da.c timers, drivers/tty/metag_da: Initialize the poll timer as pinned 2016-07-07 10:25:14 +02:00
mips_ejtag_fdc.c timers, drivers/tty/mips_ejtag: Initialize the poll timer as pinned 2016-07-07 10:34:59 +02:00
moxa.c Annotate hardware config module parameters in drivers/tty/ 2017-04-20 12:02:32 +01:00
moxa.h
mxser.c Annotate hardware config module parameters in drivers/tty/ 2017-04-20 12:02:32 +01:00
mxser.h
n_gsm.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-07-05 12:31:59 -07:00
n_hdlc.c format-security: move static strings to const 2017-05-08 17:15:14 -07:00
n_null.c tty: handle the case where we cannot restore a line discipline 2017-06-03 18:43:46 +09:00
n_r3964.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
n_tracerouter.c
n_tracesink.c
n_tracesink.h
n_tty.c
nozomi.c tty: nozomi: avoid sprintf buffer overflow 2016-11-29 20:20:07 +01:00
pty.c pty: Repair TIOCGPTPEER 2017-08-24 13:23:03 -07:00
rocket.c tty: rocket: drop broken alt-speed support 2017-06-13 11:49:58 +02:00
rocket.h
rocket_int.h
synclink.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
synclink_gt.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-07-05 12:31:59 -07:00
synclinkmp.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
sysrq.c oom: improve oom disable handling 2017-05-03 15:52:10 -07:00
tty_audit.c
tty_baudrate.c tty: move baudrate handling code to a file of its own 2017-04-18 18:01:52 +02:00
tty_buffer.c tty_port: Add port client functions 2017-02-03 10:17:02 +01:00
tty_io.c pty: Repair TIOCGPTPEER 2017-08-24 13:23:03 -07:00
tty_ioctl.c tty: move baudrate handling code to a file of its own 2017-04-18 18:01:52 +02:00
tty_jobctrl.c tty: split job control support into a file of its own 2017-04-18 18:01:52 +02:00
tty_ldisc.c TTY/Serial patches for 4.13-rc1 2017-07-03 20:04:16 -07:00
tty_ldsem.c sched/headers: Prepare to move the get_task_struct()/put_task_struct() and related APIs from <linux/sched.h> to <linux/sched/task.h> 2017-03-02 08:42:40 +01:00
tty_mutex.c
tty_port.c Revert "tty: fix port buffer locking" 2017-06-04 10:23:25 +02:00