Commit 41b98670 authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

[PATCH] USB: fix race with signal delivery in usbfs

apart from locking bugs, there are other races. This fixes one with
signal delivery. The signal should be delivered _before_ the reciever
is woken.
parent 697a025d
...@@ -261,7 +261,6 @@ static void async_completed(struct urb *urb, struct pt_regs *regs) ...@@ -261,7 +261,6 @@ static void async_completed(struct urb *urb, struct pt_regs *regs)
spin_lock(&ps->lock); spin_lock(&ps->lock);
list_move_tail(&as->asynclist, &ps->async_completed); list_move_tail(&as->asynclist, &ps->async_completed);
spin_unlock(&ps->lock); spin_unlock(&ps->lock);
wake_up(&ps->wait);
if (as->signr) { if (as->signr) {
sinfo.si_signo = as->signr; sinfo.si_signo = as->signr;
sinfo.si_errno = as->urb->status; sinfo.si_errno = as->urb->status;
...@@ -269,6 +268,7 @@ static void async_completed(struct urb *urb, struct pt_regs *regs) ...@@ -269,6 +268,7 @@ static void async_completed(struct urb *urb, struct pt_regs *regs)
sinfo.si_addr = (void *)as->userurb; sinfo.si_addr = (void *)as->userurb;
send_sig_info(as->signr, &sinfo, as->task); send_sig_info(as->signr, &sinfo, as->task);
} }
wake_up(&ps->wait);
} }
static void destroy_async (struct dev_state *ps, struct list_head *list) static void destroy_async (struct dev_state *ps, struct list_head *list)
......
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