All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Pratham Pratap <prathampratap@codeaurora.org>
Cc: linux-usb@vger.kernel.org
Subject: Re: ep0 request dequeue for function drivers
Date: Mon, 26 Apr 2021 10:41:23 +0200	[thread overview]
Message-ID: <YIZ8s6ALmGdoJgq4@kroah.com> (raw)
In-Reply-To: <655514e3-90c1-e628-d5e6-efb298f49038@codeaurora.org>

On Mon, Apr 26, 2021 at 01:42:50PM +0530, Pratham Pratap wrote:
> 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.

Have you tried making this change and determined that it works or not?
If so, please submit a patch.

thanks,

greg k-h

  reply	other threads:[~2021-04-26  8:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26  8:12 ep0 request dequeue for function drivers Pratham Pratap
2021-04-26  8:41 ` Greg KH [this message]
2021-04-26 10:17 ` Felipe Balbi
2021-04-29  8:27   ` Pratham Pratap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YIZ8s6ALmGdoJgq4@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=prathampratap@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.