From: Alan Cox Date: Thu, 30 Oct 2008 15:54:12 +0000 (+0000) Subject: tty: Fix USB kref leak X-Git-Tag: v2.6.28-rc3~42 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=fce4877a6792ad72b88f6fd7556d19da5f20364d;p=linux-2.6-omap-h63xx.git 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 Tested-by: Helge Hafting Signed-off-by: Linus Torvalds --- diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 8be3f39891c..794b5ffe439 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); } }