Skip to content

Commit

Permalink
USB: quatech2: only write to the tty if the port is open.
Browse files Browse the repository at this point in the history
The commit 2e124b4 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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
wfp5p authored and gregkh committed Mar 13, 2013
1 parent 3f8bc5e commit 27b351c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/usb/serial/quatech2.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,9 @@ void qt2_process_read_urb(struct urb *urb)
__func__);
break;
}
tty_flip_buffer_push(&port->port);

if (port_priv->is_open)
tty_flip_buffer_push(&port->port);

newport = *(ch + 3);

Expand Down Expand Up @@ -704,7 +706,8 @@ void qt2_process_read_urb(struct urb *urb)
tty_insert_flip_string(&port->port, ch, 1);
}

tty_flip_buffer_push(&port->port);
if (port_priv->is_open)
tty_flip_buffer_push(&port->port);
}

static void qt2_write_bulk_callback(struct urb *urb)
Expand Down

0 comments on commit 27b351c

Please sign in to comment.