Commit ae3759c2 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

USB: io_ti, stop dereferencing potential NULL

tty_port_tty_get might return a tty which is NULL. But it is
dereferenced unconditionally in edge_send. Stop dereferencing that by
sending usb_serial_port pointer around.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Cc: Johan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 64dc9e2e
...@@ -206,7 +206,7 @@ static int restart_read(struct edgeport_port *edge_port); ...@@ -206,7 +206,7 @@ static int restart_read(struct edgeport_port *edge_port);
static void edge_set_termios(struct tty_struct *tty, static void edge_set_termios(struct tty_struct *tty,
struct usb_serial_port *port, struct ktermios *old_termios); struct usb_serial_port *port, struct ktermios *old_termios);
static void edge_send(struct tty_struct *tty); static void edge_send(struct usb_serial_port *port, struct tty_struct *tty);
/* sysfs attributes */ /* sysfs attributes */
static int edge_create_sysfs_attrs(struct usb_serial_port *port); static int edge_create_sysfs_attrs(struct usb_serial_port *port);
...@@ -1712,7 +1712,7 @@ static void edge_bulk_out_callback(struct urb *urb) ...@@ -1712,7 +1712,7 @@ static void edge_bulk_out_callback(struct urb *urb)
/* send any buffered data */ /* send any buffered data */
tty = tty_port_tty_get(&port->port); tty = tty_port_tty_get(&port->port);
edge_send(tty); edge_send(port, tty);
tty_kref_put(tty); tty_kref_put(tty);
} }
...@@ -1940,14 +1940,13 @@ static int edge_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -1940,14 +1940,13 @@ static int edge_write(struct tty_struct *tty, struct usb_serial_port *port,
count = kfifo_in_locked(&edge_port->write_fifo, data, count, count = kfifo_in_locked(&edge_port->write_fifo, data, count,
&edge_port->ep_lock); &edge_port->ep_lock);
edge_send(tty); edge_send(port, tty);
return count; return count;
} }
static void edge_send(struct tty_struct *tty) static void edge_send(struct usb_serial_port *port, struct tty_struct *tty)
{ {
struct usb_serial_port *port = tty->driver_data;
int count, result; int count, result;
struct edgeport_port *edge_port = usb_get_serial_port_data(port); struct edgeport_port *edge_port = usb_get_serial_port_data(port);
unsigned long flags; unsigned long flags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment