Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27b351c5 authored by Bill Pemberton's avatar Bill Pemberton Committed by Greg Kroah-Hartman
Browse files

USB: quatech2: only write to the tty if the port is open.



The commit 2e124b4a 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: default avatarBill Pemberton <wfp5p@virginia.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3f8bc5e4
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -661,6 +661,8 @@ void qt2_process_read_urb(struct urb *urb)
						 __func__);
					break;
				}

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

				newport = *(ch + 3);
@@ -704,6 +706,7 @@ void qt2_process_read_urb(struct urb *urb)
		tty_insert_flip_string(&port->port, ch, 1);
	}

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