[PATCH 22/68] tty: Fix the digi acceleport driver NULL checks

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>

This now refcounts but doesn't actually check the reference was obtained in
all the places it should.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/usb/serial/digi_acceleport.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index fd35f73..b92070c 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -609,8 +609,10 @@ static void digi_wakeup_write_lock(struct work_struct *work)
 static void digi_wakeup_write(struct usb_serial_port *port)
 {
 	struct tty_struct *tty = tty_port_tty_get(&port->port);
-	tty_wakeup(tty);
-	tty_kref_put(tty);
+	if (tty) {
+		tty_wakeup(tty);
+		tty_kref_put(tty);
+	}
 }
 
 
@@ -1682,7 +1684,7 @@ static int digi_read_inb_callback(struct urb *urb)
 		priv->dp_throttle_restart = 1;
 
 	/* receive data */
-	if (opcode == DIGI_CMD_RECEIVE_DATA) {
+	if (tty && opcode == DIGI_CMD_RECEIVE_DATA) {
 		/* get flag from port_status */
 		flag = 0;
 
@@ -1763,10 +1765,12 @@ static int digi_read_oob_callback(struct urb *urb)
 			return -1;
 
 		tty = tty_port_tty_get(&port->port);
+
 		rts = 0;
-		rts = tty->termios->c_cflag & CRTSCTS;
+		if (tty)
+			rts = tty->termios->c_cflag & CRTSCTS;
 		
-		if (opcode == DIGI_CMD_READ_INPUT_SIGNALS) {
+		if (tty && opcode == DIGI_CMD_READ_INPUT_SIGNALS) {
 			spin_lock(&priv->dp_port_lock);
 			/* convert from digi flags to termiox flags */
 			if (val & DIGI_READ_INPUT_SIGNALS_CTS) {
-- 
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)