Commit 8c6c4484 authored by Duncan Sands's avatar Duncan Sands Committed by Greg Kroah-Hartman

[PATCH] USB speedtouch: fix speedtouch micro race

The disconnect routine counts the completed_receivers/spare_senders list
to see if the completion handler has finished.  It then kills the tasklet.
However the tasklet was being scheduled after adding to the lists, creating
a micro race.  So schedule the tasklet before adding to the list.
parent 860ed2a6
......@@ -334,12 +334,11 @@ static void udsl_complete_receive (struct urb *urb, struct pt_regs *regs)
return;
}
tasklet_schedule (&instance->receive_tasklet);
/* may not be in_interrupt() */
spin_lock_irqsave (&instance->completed_receivers_lock, flags);
list_add_tail (&rcv->list, &instance->completed_receivers);
spin_unlock_irqrestore (&instance->completed_receivers_lock, flags);
PDEBUG ("udsl_complete_receive: scheduling tasklet\n");
tasklet_schedule (&instance->receive_tasklet);
}
static void udsl_process_receive (unsigned long data)
......@@ -497,13 +496,12 @@ static void udsl_complete_send (struct urb *urb, struct pt_regs *regs)
return;
}
tasklet_schedule (&instance->send_tasklet);
/* may not be in_interrupt() */
spin_lock_irqsave (&instance->send_lock, flags);
list_add (&snd->list, &instance->spare_senders);
list_add (&snd->buffer->list, &instance->spare_buffers);
spin_unlock_irqrestore (&instance->send_lock, flags);
PDEBUG ("udsl_complete_send: scheduling tasklet\n");
tasklet_schedule (&instance->send_tasklet);
}
static void udsl_process_send (unsigned long data)
......
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