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

Commit 4d1ecda8 authored by Mayank Rana's avatar Mayank Rana Committed by Gerrit - the friendly Code Review server
Browse files

USB: gadget: u_bam: Fix recursive spinlock up issue



There is recursive spinlock up issue seen as below:

   CPU0 (thread 1)		CPU0 (interrupt context)
gbam2bam_connect_work()			|
	|				|
	|				|
	|				|
	|			USB reset interrupt
	|				| take dwc3->lock,
	|				| interrupt enable
	|				|
 gbam_start_endless_rx() 	dwc3_disconnect_gadget()
 	|takes port_lock_ul,   		| release dwc3->lock
	| interrupt enable		|
	|				|
dwc3_gadget_ep_queue()		composite_disconnect()
	| takes dwc3->lock		|
	|				|
				frmnet_disable()
					|
					|
				gport_rmnet_disconnect()
					|
					|
				gbam_disconnect()
					|
					|
				gbam_free_rx_buffers()
					| trying to acquire same
					| port_lock_ul which is
					| already held on thread1
					|

Hence fix this issue by using spin_lock_irqsave() and
spin_unlock_irqrestore() API for start/stop endless tx/rx APIs and also
not calling usb_ep_queue() and usb_ep_dequeue() with that acquire.
Spinlock is being used in this API to guard against disconnect
functionality and making port->port_usb to NULL which is handle now using
EP context before releasing spinlock here.

CRs-Fixed: 831709
Change-Id: Ic33a3fc8c5bd8ba256942db3e8cd3559017401db
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent f16a42b9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment