linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-usb\@vger.kernel.org" <linux-usb@vger.kernel.org>
Cc: John Youn <John.Youn@synopsys.com>
Subject: Re: [PATCH 4/6] usb: dwc3: gadget: Give back staled requests
Date: Mon, 16 Mar 2020 08:51:43 +0200	[thread overview]
Message-ID: <87eets23nk.fsf@kernel.org> (raw)
In-Reply-To: <5329c3d7-4975-a935-ee85-a51512235c95@synopsys.com>

[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]


Hi,

Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
>> Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
>>> If a request is dequeued, the transfer is cancelled. Give back all
>>> the started requests.
>>>
>>> In most scenarios, the function driver dequeues all requests of a
>>> transfer when there's a failure. If the function driver follows this,
>>> then it's fine. If not, then we'd be skipping TRBs at different points
>>> within the dequeue and enqueue pointers, making dequeue/enqueue pointers
>>> useless. To enforce and make sure that we're properly skipping TRBs,
>>> cancel all the started requests and give back all the cancelled requests
>>> to the function drivers.
>> Which function driver is *not* cancelling transfers correctly? We can
>> (and should) be defensive on dwc3, but let's not hide bugs on function
>> drivers either.
>>
>
> I didn't review all the function drivers for this. I just see a 
> potential issue and go for a more defensive approach. What's your 
> suggestion?

Fair enough, that's good for my understading of why the patch was
created. Is there a way to add a WARN() or something like that so we
catch erroneous gadget drivers easily? Also, could you check if we need
a documentation update for the gadget API with regards to this finding?

cheers

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2020-03-16  6:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05 21:23 [PATCH 0/6] usb: dwc3: gadget: Misc transfer cancellation fixes Thinh Nguyen
2020-03-05 21:23 ` [PATCH 1/6] usb: dwc3: gadget: Don't clear flags before transfer ended Thinh Nguyen
2020-03-05 21:23 ` [PATCH 2/6] usb: dwc3: gadget: Properly handle ClearFeature(halt) Thinh Nguyen
2020-03-15  9:21   ` Felipe Balbi
2020-03-16  0:34     ` Thinh Nguyen
2020-03-16  6:49       ` Felipe Balbi
2020-03-16 19:07         ` Thinh Nguyen
2020-03-05 21:24 ` [PATCH 3/6] usb: dwc3: gadget: Wrap around when skip TRBs Thinh Nguyen
2020-03-05 21:24 ` [PATCH 4/6] usb: dwc3: gadget: Give back staled requests Thinh Nguyen
2020-03-15  9:23   ` Felipe Balbi
2020-03-16  0:54     ` Thinh Nguyen
2020-03-16  6:51       ` Felipe Balbi [this message]
2020-03-16 19:37         ` Thinh Nguyen
2020-03-05 21:24 ` [PATCH 5/6] usb: dwc3: gadget: Remove unnecessary checks Thinh Nguyen
2020-03-05 21:24 ` [PATCH 6/6] usb: dwc3: gadget: Refactor dwc3_gadget_ep_dequeue Thinh Nguyen
2020-03-15  9:26   ` Felipe Balbi
2020-03-16  0:42     ` Thinh Nguyen

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=87eets23nk.fsf@kernel.org \
    --to=balbi@kernel.org \
    --cc=John.Youn@synopsys.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).