]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/usb/hso.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
[linux-2.6-omap-h63xx.git] / drivers / net / usb / hso.c
index d17dc5214c9af483ab83c712926f5c0b82c210e8..0d0fa91c025130fa96637d70a89b2cc101b89233 100644 (file)
@@ -1297,6 +1297,7 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp)
        /* setup */
        spin_lock_irq(&serial->serial_lock);
        tty->driver_data = serial;
+       tty_kref_put(serial->tty);
        serial->tty = tty_kref_get(tty);
        spin_unlock_irq(&serial->serial_lock);
 
@@ -2043,9 +2044,8 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial)
                return -2;
        }
 
-       spin_lock(&serial->serial_lock);
+       /* All callers to put_rxbuf_data hold serial_lock */
        tty = tty_kref_get(serial->tty);
-       spin_unlock(&serial->serial_lock);
 
        /* Push data to tty */
        if (tty) {
@@ -2053,8 +2053,10 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial)
                        serial->curr_rx_urb_offset;
                D1("data to push to tty");
                while (write_length_remaining) {
-                       if (test_bit(TTY_THROTTLED, &tty->flags))
+                       if (test_bit(TTY_THROTTLED, &tty->flags)) {
+                               tty_kref_put(tty);
                                return -1;
+                       }
                        curr_write_len =  tty_insert_flip_string
                                (tty, urb->transfer_buffer +
                                 serial->curr_rx_urb_offset,