Re: Linux 2.6.28-rc2 i/o error on /dev/ttyUSB0

From: Alan Cox
Date: Thu Oct 30 2008 - 11:54:24 EST


On Wed, 29 Oct 2008 13:28:42 +0100
Helge Hafting <helge.hafting@xxxxxxxxxxxxx> wrote:

> Alan Cox wrote:
> >> squarely in the "oops, kref's are screwed up" corner, and you should talk
> >> to Alan about your particular USB dongle. I bet that bisection would just
> >> show you one of the kref commits (eg 4a90f09b "tty: usb-serial krefs" or
> >> maybe 7d7b93c14 "tty: kref the tty driver object").

Please try:

tty: Fix USB kref leak

From: Alan Cox <alan@xxxxxxxxxx>

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@xxxxxxxxxx>
---

drivers/usb/serial/usb-serial.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)


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);
}
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/