Skip to content

Commit

Permalink
[PATCH] USB: One potential problem in gadget/serial.c
Browse files Browse the repository at this point in the history
It looks like that the gs_serial module maybe sleep with spinlock in gs_close.
Sometimes, system hang when I remove the gs_serial module.

From: Fengwei Yin <xaityyy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Fengwei Yin authored and Greg Kroah-Hartman committed Jan 4, 2006
1 parent 3d48586 commit 949bf64
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/usb/gadget/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,10 +890,12 @@ static void gs_close(struct tty_struct *tty, struct file *file)
/* wait for write buffer to drain, or */
/* at most GS_CLOSE_TIMEOUT seconds */
if (gs_buf_data_avail(port->port_write_buf) > 0) {
spin_unlock_irqrestore(&port->port_lock, flags);
wait_cond_interruptible_timeout(port->port_write_wait,
port->port_dev == NULL
|| gs_buf_data_avail(port->port_write_buf) == 0,
&port->port_lock, flags, GS_CLOSE_TIMEOUT * HZ);
spin_lock_irqsave(&port->port_lock, flags);
}

/* free disconnected port on final close */
Expand Down

0 comments on commit 949bf64

Please sign in to comment.