All of lore.kernel.org
 help / color / mirror / Atom feed
* ep0 request dequeue for function drivers
@ 2021-04-26  8:12 Pratham Pratap
  2021-04-26  8:41 ` Greg KH
  2021-04-26 10:17 ` Felipe Balbi
  0 siblings, 2 replies; 4+ messages in thread
From: Pratham Pratap @ 2021-04-26  8:12 UTC (permalink / raw)
  To: linux-usb

Hi,

Let's say a function driver queues a request on ep0 and before the 
completion handler could run composition switch/physical disconnect 
happens. This request will be in pending list since gadget_giveback is 
not done but the composite driver will free the request from 
composite_dev_cleanup. Now, once the next connect happens, another ep0 
request is queued and while handling the completion of that request, 
gadget driver might end up accessing the old/stale request leading to 
list_poison since pending list is corrupted.

To fix this, the function drivers might want to use setup_pending(mark 
it to true) flag so that when composite_dev_cleanup is run the requests 
are given back from usb_ep_dequeue; clear the setup pending flag in 
function driver when completion handler is run successfully. I can see 
this issue in almost all the function drivers.

Looking for suggestions and comments.

--Pratham


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-29  8:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-26  8:12 ep0 request dequeue for function drivers Pratham Pratap
2021-04-26  8:41 ` Greg KH
2021-04-26 10:17 ` Felipe Balbi
2021-04-29  8:27   ` Pratham Pratap

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.