diff options
author | Alan Cox <alan@linux.intel.com> | 2010-05-19 08:01:56 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-10 16:47:41 -0400 |
commit | 4287341d4dba27ef8048f589e3c0bc683c9f2017 (patch) | |
tree | 92f822da34f610215977154b8a792e7ae75e1369 /drivers/usb/serial | |
parent | 7479db07011c9c85a65eeb03724193230af0a99d (diff) |
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')
-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) | |||
609 | static void digi_wakeup_write(struct usb_serial_port *port) | 609 | static void digi_wakeup_write(struct usb_serial_port *port) |
610 | { | 610 | { |
611 | struct tty_struct *tty = tty_port_tty_get(&port->port); | 611 | struct tty_struct *tty = tty_port_tty_get(&port->port); |
612 | tty_wakeup(tty); | 612 | if (tty) { |
613 | tty_kref_put(tty); | 613 | tty_wakeup(tty); |
614 | tty_kref_put(tty); | ||
615 | } | ||
614 | } | 616 | } |
615 | 617 | ||
616 | 618 | ||
@@ -1682,7 +1684,7 @@ static int digi_read_inb_callback(struct urb *urb) | |||
1682 | priv->dp_throttle_restart = 1; | 1684 | priv->dp_throttle_restart = 1; |
1683 | 1685 | ||
1684 | /* receive data */ | 1686 | /* receive data */ |
1685 | if (opcode == DIGI_CMD_RECEIVE_DATA) { | 1687 | if (tty && opcode == DIGI_CMD_RECEIVE_DATA) { |
1686 | /* get flag from port_status */ | 1688 | /* get flag from port_status */ |
1687 | flag = 0; | 1689 | flag = 0; |
1688 | 1690 | ||
@@ -1763,10 +1765,12 @@ static int digi_read_oob_callback(struct urb *urb) | |||
1763 | return -1; | 1765 | return -1; |
1764 | 1766 | ||
1765 | tty = tty_port_tty_get(&port->port); | 1767 | tty = tty_port_tty_get(&port->port); |
1768 | |||
1766 | rts = 0; | 1769 | rts = 0; |
1767 | rts = tty->termios->c_cflag & CRTSCTS; | 1770 | if (tty) |
1771 | rts = tty->termios->c_cflag & CRTSCTS; | ||
1768 | 1772 | ||
1769 | if (opcode == DIGI_CMD_READ_INPUT_SIGNALS) { | 1773 | if (tty && opcode == DIGI_CMD_READ_INPUT_SIGNALS) { |
1770 | spin_lock(&priv->dp_port_lock); | 1774 | spin_lock(&priv->dp_port_lock); |
1771 | /* convert from digi flags to termiox flags */ | 1775 | /* convert from digi flags to termiox flags */ |
1772 | if (val & DIGI_READ_INPUT_SIGNALS_CTS) { | 1776 | if (val & DIGI_READ_INPUT_SIGNALS_CTS) { |