diff options
author | Bill Pemberton <wfp5p@virginia.edu> | 2013-03-13 09:50:15 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-13 15:32:47 -0400 |
commit | 27b351c5546008c640b3e65152f60ca74b3706f1 (patch) | |
tree | 766c1d602d3942be6ba24086c7752926f70197c5 /drivers/usb | |
parent | 3f8bc5e4da29c7e05edeca6b475abb4fb01a5a13 (diff) |
USB: quatech2: only write to the tty if the port is open.
The commit 2e124b4a390ca85325fae75764bef92f0547fa25 removed the checks
that prevented qt2_process_read_urb() from trying to put chars into
ttys that weren't actually opened. This resulted in 'tty is NULL'
warnings from flush_to_ldisc() when the device was used.
The devices use just one read urb for all ports. As a result
qt2_process_read_urb() may be called with the current port set to a
port number that has not been opened. Add a check if the port is open
before calling tty_flip_buffer_push().
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/serial/quatech2.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c index 00e6c9bac8a3..d643a4d4d770 100644 --- a/drivers/usb/serial/quatech2.c +++ b/drivers/usb/serial/quatech2.c | |||
@@ -661,7 +661,9 @@ void qt2_process_read_urb(struct urb *urb) | |||
661 | __func__); | 661 | __func__); |
662 | break; | 662 | break; |
663 | } | 663 | } |
664 | tty_flip_buffer_push(&port->port); | 664 | |
665 | if (port_priv->is_open) | ||
666 | tty_flip_buffer_push(&port->port); | ||
665 | 667 | ||
666 | newport = *(ch + 3); | 668 | newport = *(ch + 3); |
667 | 669 | ||
@@ -704,7 +706,8 @@ void qt2_process_read_urb(struct urb *urb) | |||
704 | tty_insert_flip_string(&port->port, ch, 1); | 706 | tty_insert_flip_string(&port->port, ch, 1); |
705 | } | 707 | } |
706 | 708 | ||
707 | tty_flip_buffer_push(&port->port); | 709 | if (port_priv->is_open) |
710 | tty_flip_buffer_push(&port->port); | ||
708 | } | 711 | } |
709 | 712 | ||
710 | static void qt2_write_bulk_callback(struct urb *urb) | 713 | static void qt2_write_bulk_callback(struct urb *urb) |