From: Alan Stern <stern@rowland.harvard.edu>
To: daixin_tkzc <daixin_tkzc@163.com>
Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>,
Greg KH <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net,
linux-kernel@vger.kernel.org
Subject: Re: Re: Re: [usb-storage] Re:Re:[PATCH] usb: storage: Fix `us->iobuf` size for BOT transmission to prevent memory overflow
Date: Sat, 15 Mar 2025 14:40:38 -0400 [thread overview]
Message-ID: <6b4fe6ca-e18b-4843-aeaf-224ee01d3067@rowland.harvard.edu> (raw)
In-Reply-To: <265533ba.2e97.1959988d8b1.Coremail.daixin_tkzc@163.com>
On Sat, Mar 15, 2025 at 07:20:37PM +0800, daixin_tkzc wrote:
> I'm sorry you may have misunderstood me.
>
>
> HCTSIZ register only reflects the transfer size for the Host Channel (between host and device). The dwc_otg manual explains it as follows:
> Non-Scatter/Gather DMA Mode:
> Transfer Size (XferSize)
> For an OUT, this field is the number of data bytes the host sends
> during the transfer.
> For an IN, this field is the buffer size that the application has
> Reserved for the transfer. The application is expected to program
> this field as an integer multiple of the maximum packet size for IN
> transactions (periodic and non-periodic).
In that case, the dwc_otg driver needs to use a 512-byte bounce buffer.
The driver must _guarantee_ that no more than 13 bytes will be written
to the URB's transfer_buffer if the URB's transfer_length is 13. If the
hardware cannot provide this guarantee then the driver must work around
the hardware's deficiencies. That is how the kernel's USB API is
designed.
Alan Stern
prev parent reply other threads:[~2025-03-15 18:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-11 8:41 [PATCH] " Xin Dai
2025-03-11 9:48 ` Greg KH
2025-03-11 14:12 ` Alan Stern
2025-03-12 1:09 ` [usb-storage] " Matthew Dharm
2025-03-13 12:12 ` daixin_tkzc
2025-03-13 14:36 ` Alan Stern
[not found] ` <1681f087.2727.195927b7ccb.Coremail.daixin_tkzc@163.com>
2025-03-14 5:37 ` [usb-storage] " Matthew Dharm
2025-03-14 5:43 ` Greg KH
2025-03-14 5:44 ` Greg KH
2025-03-14 14:16 ` [usb-storage] " Alan Stern
[not found] ` <6e125c5c.2541.195990d2daa.Coremail.daixin_tkzc@163.com>
2025-03-15 9:34 ` Greg KH
2025-03-15 9:37 ` Matthew Dharm
[not found] ` <265533ba.2e97.1959988d8b1.Coremail.daixin_tkzc@163.com>
2025-03-15 18:40 ` Alan Stern [this message]
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=6b4fe6ca-e18b-4843-aeaf-224ee01d3067@rowland.harvard.edu \
--to=stern@rowland.harvard.edu \
--cc=daixin_tkzc@163.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mdharm-usb@one-eyed-alien.net \
--cc=usb-storage@lists.one-eyed-alien.net \
/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
all inboxes | Powered by JetHome®