hso: fix refcounting on the ttyHSx devices
authorOlivier Blin <blino@mandriva.com>
Fri, 8 Aug 2008 19:01:41 +0000 (12:01 -0700)
committerJeff Garzik <jgarzik@redhat.com>
Thu, 14 Aug 2008 08:43:46 +0000 (04:43 -0400)
The references on ttyHSx devices were not decremented correctly when
the tty was closed. The helper freeing the serial devices was never
called because of that, and the module left some dangling sysfs
devices after being unloaded.

Signed-off-by: Olivier Blin <blino@mandriva.com>
Cc: Jari Tenhunen <jari.tenhunen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/net/usb/hso.c

index 94a27f7..94c41bb 100644 (file)
@@ -1103,8 +1103,8 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp)
        /* reset the rts and dtr */
        /* do the actual close */
        serial->open_count--;
+       kref_put(&serial->parent->ref, hso_serial_ref_free);
        if (serial->open_count <= 0) {
-               kref_put(&serial->parent->ref, hso_serial_ref_free);
                serial->open_count = 0;
                if (serial->tty) {
                        serial->tty->driver_data = NULL;