Skip to content

Commit

Permalink
hso: fix soft-lockup
Browse files Browse the repository at this point in the history
Fix soft-lockup in hso.c which is triggered on SMP machine when
modem is removed while file descriptor(s) under /dev are still open:

  old version called kref_put() too early which resulted in destroying
  hso_serial and hso_device objects which were still used later on.

Signed-off-by: Antti Kaijanmäki <antti.kaijanmaki@nomovok.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Antti Kaijanmäki authored and David S. Miller committed Nov 23, 2009
1 parent 9ce673d commit dcfcb25
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/usb/hso.c
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@ 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) {
serial->open_count = 0;
spin_lock_irq(&serial->serial_lock);
Expand All @@ -1383,6 +1383,8 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp)
usb_autopm_put_interface(serial->parent->interface);

mutex_unlock(&serial->parent->mutex);

kref_put(&serial->parent->ref, hso_serial_ref_free);
}

/* close the requested serial port */
Expand Down

0 comments on commit dcfcb25

Please sign in to comment.