[PATCH 28/68] tty: Make vt's have a tty_port

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Greg Kroah-Hartman
Date: Tuesday, August 10, 2010 - 2:58 pm

From: Alan Cox <alan@linux.intel.com>

The vt layer isn't safely handling reference counts to tty object on the input
side. Add a tty port structure to the vt layer in order to implement this using
the standard helpers.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/char/vt.c              |    2 ++
 include/linux/console_struct.h |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 9f67ad9..295af82 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -783,6 +783,7 @@ int vc_allocate(unsigned int currcons)	/* return 0 on success */
 	    if (!vc)
 		return -ENOMEM;
 	    vc_cons[currcons].d = vc;
+	    tty_port_init(&vc->port);
 	    INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
 	    visual_init(vc, currcons, 1);
 	    if (!*vc->vc_uni_pagedir_loc)
@@ -2921,6 +2922,7 @@ static int __init con_init(void)
 	for (currcons = 0; currcons < MIN_NR_CONSOLES; currcons++) {
 		vc_cons[currcons].d = vc = kzalloc(sizeof(struct vc_data), GFP_NOWAIT);
 		INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
+		tty_port_init(&vc->port);
 		visual_init(vc, currcons, 1);
 		vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT);
 		vc_init(vc, vc->vc_rows, vc->vc_cols,
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index d7d9acd..25bf67f 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -21,6 +21,8 @@ struct vt_struct;
 #define NPAR 16
 
 struct vc_data {
+	struct tty_port port;			/* Upper level data */
+
 	unsigned short	vc_num;			/* Console number */
 	unsigned int	vc_cols;		/* [#] Console size */
 	unsigned int	vc_rows;
-- 
1.7.2

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[GIT PATCH] TTY patches for 2.6.36, try 2, Greg KH, (Tue Aug 10, 2:44 pm)
[PATCH 01/68] n_gsm.c: removed duplicated #includes, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 02/68] serial: There's no config CONSOLE, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 03/68] vt: clean up the code - use kernel library, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 04/68] serial: add UART_CAP_EFR and UART_CAP_SLEEP ..., Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 05/68] mrst_max3110: add UART driver for Max3110 on ..., Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 06/68] max3110 sanity check a register, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 07/68] serial: replace open coded mutex with a real ..., Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 08/68] serial: fix wakup races in the mrst_max3110 ..., Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 09/68] tty: Remove Hayes ESP ioctls, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 10/68] tty: remove remaining Hayes ESP ioctls, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 11/68] tty: Add EXTPROC support for LINEMODE, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 12/68] vt/console: try harder to print output when ..., Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 13/68] stallion: prune lock_kernel calls, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 14/68] istallion: use bit ops for the board flags, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 15/68] riscom8: kill use of lock_kernel, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 16/68] isicom: kill off the BKL, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 17/68] rocket: kill BKL, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 18/68] synclink: kill the big kernel lock, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 19/68] cyclades: Kill off BKL usage, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 20/68] epca: Kill the big kernel lock, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 21/68] specialix: Kill the BKL, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 22/68] tty: Fix the digi acceleport driver NULL checks, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 23/68] synclink: reworking locking a bit, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 24/68] tty: serial - fix various misuses/mishandlin ..., Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 25/68] tty: serial - fix tty back references in termios, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 26/68] tty: serial - fix tty referencing in set_ldisc, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 27/68] vc: Locking clean up, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 28/68] tty: Make vt's have a tty_port, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 29/68] tty: Move the vt_tty field from the vc_data ..., Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 30/68] serial: Change the wait for carrier locking, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 31/68] serial: add port helpers, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 32/68] serial: trim locking on the helpers, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 33/68] serial: Use block_til_ready helper, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 34/68] serial: fix termios settings in open, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 35/68] tty: replace BKL with a new tty_lock, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 36/68] tty: never hold BTM while getting tty_mutex, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 37/68] tty: fix console_sem lock order, Greg Kroah-Hartman, (Tue Aug 10, 2:58 pm)
[PATCH 38/68] cdc-acm: remove dead code, Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 39/68] tty: introduce wait_event_interruptible_tty, Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 40/68] tty: reorder ldisc locking, Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 41/68] tty: untangle locking of wait_until_sent, Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 42/68] tty: remove tty_lock_nested, Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 43/68] tty: implement BTM as mutex instead of BKL, Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 44/68] tty: release BTM while sleeping in block_til ..., Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 45/68] 8250: fix set_ldisc operation, Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 46/68] tty: avoid recursive BTM in pty_close, Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 47/68] serial: max3107: introduce a max3107 driver, Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 48/68] serial: max3107: Abstract out the platform s ..., Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 49/68] tty_io: remove casts from void*, Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 50/68] vt: Fix warning: statement with no effect du ..., Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 51/68] serial: crisv10: formatting of pointers in p ..., Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 53/68] serial: fix missing bit coverage of ASYNC_FLAGS, Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 54/68] serial: general fixes in the serial_rs485 st ..., Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 55/68] serial: mcf: don't take spinlocks in already ..., Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 56/68] serial: MMIO32 support for 8250_early.c, Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 57/68] timbuart: use __devinit and __devexit macros ..., Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 58/68] serial: 68328serial.c: remove dead (ALMA_ANS ..., Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 59/68] serial: add support for OX16PCI958 card, Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 60/68] mxser: remove unnesesary NULL check, Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 61/68] hsu: driver for Medfield High Speed UART device, Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 62/68] hsu: add a periodic timer to check dma rx ch ..., Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 63/68] hsu: some code cleanup, Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 64/68] hsu: call PCI pm hooks in suspend/resume fun ..., Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 65/68] serial: max3107: Fix gpiolib support, Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)
[PATCH 68/68] U6715 16550A serial driver support, Greg Kroah-Hartman, (Tue Aug 10, 2:59 pm)