aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/usbip/stub_rx.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/stub_rx.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/stub_rx.c')
-rw-r--r--drivers/staging/usbip/stub_rx.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/usbip/stub_rx.c b/drivers/staging/usbip/stub_rx.c
index 0572a15242b..e7458e1ad15 100644
--- a/drivers/staging/usbip/stub_rx.c
+++ b/drivers/staging/usbip/stub_rx.c
@@ -307,12 +307,12 @@ static int valid_request(struct stub_device *sdev, struct usbip_header *pdu)
int valid = 0;
if (pdu->base.devid == sdev->devid) {
- spin_lock(&ud->lock);
+ spin_lock_irq(&ud->lock);
if (ud->status == SDEV_ST_USED) {
/* A request is valid. */
valid = 1;
}
- spin_unlock(&ud->lock);
+ spin_unlock_irq(&ud->lock);
}
return valid;