Skip to content

Commit fce4877

Browse files
Alan Coxtorvalds
authored andcommitted
tty: Fix USB kref leak
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>
1 parent 0fb7f4f commit fce4877

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎drivers/usb/serial/usb-serial.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ static void serial_close(struct tty_struct *tty, struct file *filp)
281281
if (tty->driver_data)
282282
tty->driver_data = NULL;
283283
tty_port_tty_set(&port->port, NULL);
284+
tty_kref_put(tty);
284285
}
285286
}
286287

0 commit comments

Comments
 (0)