Skip to content

Commit

Permalink
USB: serial: omninet: fix reference leaks at open
Browse files Browse the repository at this point in the history
commit 3057241 upstream.

This driver needlessly took another reference to the tty on open, a
reference which was then never released on close. This lead to not just
a leak of the tty, but also a driver reference leak that prevented the
driver from being unloaded after a port had once been opened.

Fixes: 4a90f09 ("tty: usb-serial krefs")
Signed-off-by: Johan Hovold <johan@kernel.org>
[bwh: Backported to 3.2:
 - The 'serial' variable is still needed for other initialisation
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
  • Loading branch information
Johan Hovold authored and Ben Hutchings committed Jun 5, 2017
1 parent 6d0c587 commit 8b23634
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions drivers/usb/serial/omninet.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,10 @@ static int omninet_attach(struct usb_serial *serial)
static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port)
{
struct usb_serial *serial = port->serial;
struct usb_serial_port *wport;
int result = 0;

dbg("%s - port %d", __func__, port->number);

wport = serial->port[1];
tty_port_tty_set(&wport->port, tty);

/* Start reading from the device */
usb_fill_bulk_urb(port->read_urb, serial->dev,
usb_rcvbulkpipe(serial->dev,
Expand Down

0 comments on commit 8b23634

Please sign in to comment.