aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/usbip/usbip_event.c
diff options
context:
space:
mode:
authorHarvey Yang <harvey.huawei.yang@gmail.com>2013-01-22 13:31:30 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-22 09:00:10 -0800
commitdcf14779280215d1765141ce04c675df3e4301c5 (patch)
tree3924edec0e5a56e4c70fdc57403de3c4c6a7e88f /drivers/staging/usbip/usbip_event.c
parent26ef1021c1c7ba62a2790296546945022468e17d (diff)
staging: usbip: use interrupt safe spinlock to avoid potential deadlock.
The function 'usbip_event_add()' may be called in interrupt context on the stub side: 'stub_complete'->'stub_enqueue_ret_unlink'->'usbip_event_add'. In this function it tries to get the lock 'ud->lock', so we should disable irq when we get this lock in process context. Signed-off-by: Harvey Yang <harvey.huawei.yang@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/usbip/usbip_event.c')
-rw-r--r--drivers/staging/usbip/usbip_event.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/staging/usbip/usbip_event.c b/drivers/staging/usbip/usbip_event.c
index d332a34ddb6..82123be8732 100644
--- a/drivers/staging/usbip/usbip_event.c
+++ b/drivers/staging/usbip/usbip_event.c
@@ -105,10 +105,12 @@ EXPORT_SYMBOL_GPL(usbip_stop_eh);
void usbip_event_add(struct usbip_device *ud, unsigned long event)
{
- spin_lock(&ud->lock);
+ unsigned long flags;
+
+ spin_lock_irqsave(&ud->lock, flags);
ud->event |= event;
wake_up(&ud->eh_waitq);
- spin_unlock(&ud->lock);
+ spin_unlock_irqrestore(&ud->lock, flags);
}
EXPORT_SYMBOL_GPL(usbip_event_add);