Commit 762f007b authored by Jarek Poplawski's avatar Jarek Poplawski Committed by Greg Kroah-Hartman

USB: fix cdc-acm problems with hard irq? (inconsistent lock state)

Signed-off-by: default avatarJarek Poplawski <jarkao2@o2.pl>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a7a0c9cd
...@@ -325,7 +325,7 @@ static void acm_rx_tasklet(unsigned long _acm) ...@@ -325,7 +325,7 @@ static void acm_rx_tasklet(unsigned long _acm)
struct acm_rb *buf; struct acm_rb *buf;
struct tty_struct *tty = acm->tty; struct tty_struct *tty = acm->tty;
struct acm_ru *rcv; struct acm_ru *rcv;
//unsigned long flags; unsigned long flags;
int i = 0; int i = 0;
dbg("Entering acm_rx_tasklet"); dbg("Entering acm_rx_tasklet");
...@@ -333,15 +333,15 @@ static void acm_rx_tasklet(unsigned long _acm) ...@@ -333,15 +333,15 @@ static void acm_rx_tasklet(unsigned long _acm)
return; return;
next_buffer: next_buffer:
spin_lock(&acm->read_lock); spin_lock_irqsave(&acm->read_lock, flags);
if (list_empty(&acm->filled_read_bufs)) { if (list_empty(&acm->filled_read_bufs)) {
spin_unlock(&acm->read_lock); spin_unlock_irqrestore(&acm->read_lock, flags);
goto urbs; goto urbs;
} }
buf = list_entry(acm->filled_read_bufs.next, buf = list_entry(acm->filled_read_bufs.next,
struct acm_rb, list); struct acm_rb, list);
list_del(&buf->list); list_del(&buf->list);
spin_unlock(&acm->read_lock); spin_unlock_irqrestore(&acm->read_lock, flags);
dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d", buf, buf->size); dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d", buf, buf->size);
...@@ -356,29 +356,29 @@ static void acm_rx_tasklet(unsigned long _acm) ...@@ -356,29 +356,29 @@ static void acm_rx_tasklet(unsigned long _acm)
memmove(buf->base, buf->base + i, buf->size - i); memmove(buf->base, buf->base + i, buf->size - i);
buf->size -= i; buf->size -= i;
spin_unlock(&acm->throttle_lock); spin_unlock(&acm->throttle_lock);
spin_lock(&acm->read_lock); spin_lock_irqsave(&acm->read_lock, flags);
list_add(&buf->list, &acm->filled_read_bufs); list_add(&buf->list, &acm->filled_read_bufs);
spin_unlock(&acm->read_lock); spin_unlock_irqrestore(&acm->read_lock, flags);
return; return;
} }
spin_unlock(&acm->throttle_lock); spin_unlock(&acm->throttle_lock);
spin_lock(&acm->read_lock); spin_lock_irqsave(&acm->read_lock, flags);
list_add(&buf->list, &acm->spare_read_bufs); list_add(&buf->list, &acm->spare_read_bufs);
spin_unlock(&acm->read_lock); spin_unlock_irqrestore(&acm->read_lock, flags);
goto next_buffer; goto next_buffer;
urbs: urbs:
while (!list_empty(&acm->spare_read_bufs)) { while (!list_empty(&acm->spare_read_bufs)) {
spin_lock(&acm->read_lock); spin_lock_irqsave(&acm->read_lock, flags);
if (list_empty(&acm->spare_read_urbs)) { if (list_empty(&acm->spare_read_urbs)) {
spin_unlock(&acm->read_lock); spin_unlock_irqrestore(&acm->read_lock, flags);
return; return;
} }
rcv = list_entry(acm->spare_read_urbs.next, rcv = list_entry(acm->spare_read_urbs.next,
struct acm_ru, list); struct acm_ru, list);
list_del(&rcv->list); list_del(&rcv->list);
spin_unlock(&acm->read_lock); spin_unlock_irqrestore(&acm->read_lock, flags);
buf = list_entry(acm->spare_read_bufs.next, buf = list_entry(acm->spare_read_bufs.next,
struct acm_rb, list); struct acm_rb, list);
...@@ -400,9 +400,9 @@ static void acm_rx_tasklet(unsigned long _acm) ...@@ -400,9 +400,9 @@ static void acm_rx_tasklet(unsigned long _acm)
free-urbs-pool and resubmited ASAP */ free-urbs-pool and resubmited ASAP */
if (usb_submit_urb(rcv->urb, GFP_ATOMIC) < 0) { if (usb_submit_urb(rcv->urb, GFP_ATOMIC) < 0) {
list_add(&buf->list, &acm->spare_read_bufs); list_add(&buf->list, &acm->spare_read_bufs);
spin_lock(&acm->read_lock); spin_lock_irqsave(&acm->read_lock, flags);
list_add(&rcv->list, &acm->spare_read_urbs); list_add(&rcv->list, &acm->spare_read_urbs);
spin_unlock(&acm->read_lock); spin_unlock_irqrestore(&acm->read_lock, flags);
return; return;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment