projects/linux·commit fce4877a

tty: Fix USB kref leak

fce4877a · Alan Cox <[email protected]> · 2008-10-30 15:54:12 +00:00

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 <[email protected]>
Tested-by: Helge Hafting <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Commit
fce4877a6792ad72b88f6fd7556d19da5f20364d
Parents
0fb7f4f0

Changes

1 files changed · +1 −0

FileStatusAddDelContent
drivers/usb/serial/usb-serial.cmodified+1−0View file

drivers/usb/serial/usb-serial.c

View file
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 8be3f39..794b5ff 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -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);
}
}