Skip to content

Commit

Permalink
tty: Fix USB kref leak
Browse files Browse the repository at this point in the history
When we close we must clear the extra reference we got when we read
port->tty. Setting the port tty NULL will clear the kref held by the driver
but not the one we obtained ourselves while doing the lookup.

Signed-off-by: Alan Cox <alan@redhat.com>
Tested-by: Helge Hafting <helge.hafting@aitel.hist.no>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Alan Cox authored and Linus Torvalds committed Oct 30, 2008
1 parent 0fb7f4f commit fce4877
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/usb/serial/usb-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ static void serial_close(struct tty_struct *tty, struct file *filp)
if (tty->driver_data)
tty->driver_data = NULL;
tty_port_tty_set(&port->port, NULL);
tty_kref_put(tty);
}
}

Expand Down

0 comments on commit fce4877

Please sign in to comment.