Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ffb81726 authored by Pratham Pratap's avatar Pratham Pratap Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarPratham Pratap <prathampratap@codeaurora.org>
Signed-off-by: default avatarAjay Agarwal <ajaya@codeaurora.org>
parent 77988086
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1161,8 +1161,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;

@@ -1177,7 +1178,7 @@ static void gsi_ctrl_clear_cpkt_queues(struct f_gsi *gsi, bool skip_req_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)