summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorPratham Pratap <prathampratap@codeaurora.org>2017-09-12 12:11:48 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2017-10-02 23:23:58 -0700
commit8f84d3cbc8cabd0c9c62538c28665262e85fe8cd (patch)
tree25a4e4cf2e451bbe9feb7bc566e3c86c18fe12cb /drivers/usb
parentbd208931386764a067e10e686d4735d03830e9d6 (diff)
usb: gadget: gsi: Avoid spinlock lockup
In this case gsi_ctrl_clear_cpkt_queues function is called which is holding spinlock and in the meantime dwc3_interrupt occurred on same CPU which in turn is calling gsi_ctrl_clear_cpkt_queues function and it is trying to acquire the same spinlock causing deadlock. This change disables the interrupts when spinlock is acquired in gsi_ctrl_clear_cpkt_queues function. Change-Id: Ia87a0a283ca6b6298083dddb448e4d649a4f8e89 Signed-off-by: Pratham Pratap <prathampratap@codeaurora.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/function/f_gsi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/usb/gadget/function/f_gsi.c b/drivers/usb/gadget/function/f_gsi.c
index 1900870eee39..3b925d9b000e 100644
--- a/drivers/usb/gadget/function/f_gsi.c
+++ b/drivers/usb/gadget/function/f_gsi.c
@@ -885,8 +885,9 @@ static void gsi_ctrl_clear_cpkt_queues(struct f_gsi *gsi, bool skip_req_q)
{
struct gsi_ctrl_pkt *cpkt = NULL;
struct list_head *act, *tmp;
+ unsigned long flags;
- spin_lock(&gsi->c_port.lock);
+ spin_lock_irqsave(&gsi->c_port.lock, flags);
if (skip_req_q)
goto clean_resp_q;
@@ -901,7 +902,7 @@ clean_resp_q:
list_del(&cpkt->list);
gsi_ctrl_pkt_free(cpkt);
}
- spin_unlock(&gsi->c_port.lock);
+ spin_unlock_irqrestore(&gsi->c_port.lock, flags);
}
static int gsi_ctrl_send_cpkt_tomodem(struct f_gsi *gsi, void *buf, size_t len)