diff options
author | Alan Cox <alan@linux.intel.com> | 2010-05-19 13:01:56 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-10 13:47:41 -0700 |
commit | 4287341d4dba27ef8048f589e3c0bc683c9f2017 (patch) | |
tree | 92f822da34f610215977154b8a792e7ae75e1369 /drivers/usb/serial/digi_acceleport.c | |
parent | 7479db07011c9c85a65eeb03724193230af0a99d (diff) | |
download | linux-stable-4287341d4dba27ef8048f589e3c0bc683c9f2017.tar.gz linux-stable-4287341d4dba27ef8048f589e3c0bc683c9f2017.tar.bz2 linux-stable-4287341d4dba27ef8048f589e3c0bc683c9f2017.zip |
tty: Fix the digi acceleport driver NULL checks
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>
Diffstat (limited to 'drivers/usb/serial/digi_acceleport.c')
-rw-r--r-- | 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 fd35f73b5721..b92070c103cd 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) { |