public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: daixin_tkzc <daixin_tkzc@163.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	matthew dharm <mdharm-usb@one-eyed-alien.net>,
	linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net,
	linux-kernel@vger.kernel.org
Subject: Re: Re:[PATCH] usb: storage: Fix `us->iobuf` size for BOT transmission to prevent memory overflow
Date: Fri, 14 Mar 2025 06:44:54 +0100	[thread overview]
Message-ID: <2025031402-fastness-humming-e87c@gregkh> (raw)
In-Reply-To: <1681f087.2727.195927b7ccb.Coremail.daixin_tkzc@163.com>

On Fri, Mar 14, 2025 at 10:28:41AM +0800, daixin_tkzc wrote:
> How us->iobuf overflow could occur?
> 
> For 1), the USB device does not know that a Babble Error has occurred at this time (DWC_otg knows what happened), It actually continuously returns 512 bytes data through DMA write to CSW address (As can be seen in the waveform in the appendix document before). The DWC_otg controller driver cannot control how much data the device returns(13 or 512 bytes). However, the USB storage driver pre-allocates a default buffer size of 64 bytes for CBW/CSW.

If this really is true, it is a bug in the dwc driver.  Please fix it
there, otherwise you will have to modify every single USB driver in
Linux to have a larger buffer size, not just the storage one.

thanks,

greg k-h

  parent reply	other threads:[~2025-03-14  5:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-11  8:41 [PATCH] usb: storage: Fix `us->iobuf` size for BOT transmission to prevent memory overflow 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 [this message]
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

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=2025031402-fastness-humming-e87c@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=daixin_tkzc@163.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mdharm-usb@one-eyed-alien.net \
    --cc=stern@rowland.harvard.edu \
    --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