linux/drivers/tty
Jiri Slaby a2f892060f TTY: hvc, fix TTY refcounting
A -next commit "TTY: HVC, use tty from tty_port" switched the driver
to use tty_port helper for tty refcounting. But it omitted to remove
manual tty refcounting from open, close and hangup. So now we are
getting random crashes caused by use-after-free:
Unable to handle kernel paging request for data at address 0xc0000003f9d550
Faulting instruction address: 0xc0000000001b7f40
Oops: Kernel access of bad area, sig: 11 [#1]
...
NIP: c0000000001b7f40 LR: c0000000001b7f14 CTR: c0000000000e04f0
...
NIP [c0000000001b7f40] .__kmalloc+0x70/0x230
LR [c0000000001b7f14] .__kmalloc+0x44/0x230
Call Trace:
[c0000003f68bf930] [c0000003f68bf9b0] 0xc0000003f68bf9b0 (unreliable)
[c0000003f68bf9e0] [c0000000001e5424] .alloc_fdmem+0x24/0x70
[c0000003f68bfa60] [c0000000001e54f8] .alloc_fdtable+0x88/0x130
[c0000003f68bfaf0] [c0000000001e5924] .dup_fd+0x384/0x450
[c0000003f68bfbd0] [c00000000009a310] .copy_process+0x880/0x11d0
[c0000003f68bfcd0] [c00000000009aee0] .do_fork+0x70/0x400
[c0000003f68bfdc0] [c0000000000141c4] .sys_clone+0x54/0x70
[c0000003f68bfe30] [c000000000009aa0] .ppc_clone+0x8/0xc

Fix that by complete removal of tty_kref_get/put in open/close/hangup
paths.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reported-and-tested-by: Michael Neuling <mikey@neuling.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: ppc-dev <linuxppc-dev@lists.ozlabs.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-13 10:54:43 -07:00
..
hvc TTY: hvc, fix TTY refcounting 2012-04-13 10:54:43 -07:00
ipwireless TTY: ipwireless, use tty from tty_port 2012-04-09 11:30:39 -07:00
serial pch_uart: Fix duplicate memory release issue 2012-04-09 12:08:42 -07:00
vt tty/vt: handle bad user buffer in {G,P}IO_CMAP ioctl 2012-04-09 12:10:23 -07:00
Kconfig tty/powerpc: early udbg consoles can't be modules 2012-02-24 16:11:50 -08:00
Makefile tty/powerpc: introduce the ePAPR embedded hypervisor byte channel driver 2011-08-23 10:32:56 -07:00
amiserial.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
bfin_jtag_comm.c TTY: bfin_jtag_comm, use tty from tty_port 2012-04-09 11:28:18 -07:00
cyclades.c TTY: remove unneeded tty->index checks 2012-03-08 11:42:21 -08:00
ehv_bytechan.c TTY: remove re-assignments to tty_driver members 2012-03-08 11:37:58 -08:00
isicom.c Documentation: remove references to /etc/modprobe.conf 2012-03-30 16:03:15 -07:00
moxa.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
moxa.h
mxser.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
mxser.h
n_gsm.c TTY: remove re-assignments to tty_driver members 2012-03-08 11:37:58 -08:00
n_hdlc.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
n_r3964.c
n_tracerouter.c
n_tracesink.c
n_tracesink.h
n_tty.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
nozomi.c TTY: remove re-assignments to tty_driver members 2012-03-08 11:37:58 -08:00
pty.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
rocket.c TTY: remove unneeded tty->index checks 2012-03-08 11:42:21 -08:00
rocket.h
rocket_int.h
synclink.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
synclink_gt.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
synclinkmp.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
sysrq.c sysrq: use SEND_SIG_FORCED instead of force_sig() 2012-04-05 15:25:50 -07:00
tty_audit.c
tty_buffer.c tty: hold lock across tty buffer finding and buffer filling 2012-04-09 12:12:45 -07:00
tty_io.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
tty_ioctl.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
tty_ldisc.c Merge 3.2-rc3 into tty-next to handle merge conflict in tty_ldisc.c 2011-11-26 20:07:25 -08:00
tty_mutex.c TTY: remove tty_locked 2011-08-23 10:34:07 -07:00
tty_port.c TTY: fix UV serial console regression 2012-01-24 12:55:37 -08:00