From: Robert Jarzmik Date: Wed, 27 Jan 2010 17:38:03 +0000 (+0100) Subject: USB: pxa27x_udc: Fix deadlocks on request queueing X-Git-Tag: v2.6.34-rc1~215^2~51 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e23e90f33888769ffe253663cc5f3ea0bb6da49;p=pandora-kernel.git USB: pxa27x_udc: Fix deadlocks on request queueing As reported by Antonio, there are cases where the ep->lock can be taken twice, triggering a deadlock. The typical sequence is : irq_handler \ -> gadget.complete() \ -> pxa27x_udc.pxa_ep_queue() : ep->lock is taken \ -> gadget.complete() \ -> pxa27x_udc.pxa_ep_queue() : ep->lock is taken ==> *deadlock* The patch fixes this by : - releasing the lock each time gadget.complete() is called - adding a check in handle_ep() to detect a recursive call, in which case the function becomes on no-op. The patch is still not good enough for ep0. For this unique endpoint, another well thought over patch will be needed. Reported-by: Antonio Ospite Tested-by: Antonio Ospite Signed-off-by: Robert Jarzmik Cc: David Brownell Cc: Eric Miao Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed