Linux USB
 help / color / mirror / Atom feed
From: Igor Skalkin <igor.skalkin@oss.qualcomm.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	Felipe Balbi <balbi@ti.com>,
	Tatyana Brokhman <tlinder@codeaurora.org>,
	Kees Cook <kees@kernel.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Sebastian Urban <surban@surban.net>,
	Seungjin Bae <eeodqql09@gmail.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Trilok Soni <trilok.soni@oss.qualcomm.com>,
	Igor Skalkin <igor.skalkin@oss.qualcomm.com>
Subject: [PATCH 2/4] usb: gadget: dummy_hcd: fix false overflow on bounded IN
Date: Fri,  7 Aug 2026 09:54:36 +0200	[thread overview]
Message-ID: <20260807075438.5566-3-igor.skalkin@oss.qualcomm.com> (raw)
In-Reply-To: <20260807075438.5566-1-igor.skalkin@oss.qualcomm.com>

In transfer(), the IN short-packet path reports -EOVERFLOW when
dev_len > host_len.

For IN transfers this is a valid bounded completion: the host asked for
host_len bytes and the transfer is limited by the host buffer. It is not
an overflow condition.

Treat bounded IN short completion as success.

This fixes spurious failures in usbtest bulk IN varying-length cases.

Assisted-by: OpenCode:claude-sonnet-5
Signed-off-by: Igor Skalkin <igor.skalkin@oss.qualcomm.com>
---
 drivers/usb/gadget/udc/dummy_hcd.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
index 29f671c7b319..5384806347ab 100644
--- a/drivers/usb/gadget/udc/dummy_hcd.c
+++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -1486,11 +1486,13 @@ static int transfer(struct dummy_hcd *dum_hcd, struct urb *urb,
 				req->req.status = 0;
 				*status = 0;
 			} else if (to_host) {
+				/*
+				 * Host requested fewer bytes than the gadget
+				 * request currently has pending. This is a
+				 * normal bounded IN transfer, not overflow.
+				 */
 				req->req.status = 0;
-				if (dev_len > host_len)
-					*status = -EOVERFLOW;
-				else
-					*status = 0;
+				*status = 0;
 			} else {
 				*status = 0;
 				if (host_len > dev_len)
-- 
2.49.0


  parent reply	other threads:[~2026-08-07  7:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07  7:54 [PATCH 0/4] usb: gadget: dummy_hcd: fixes found while testing virtio-usb Igor Skalkin
2026-08-07  7:54 ` [PATCH 1/4] usb: gadget: dummy_hcd: fix SuperSpeed ep0 maxpacket Igor Skalkin
2026-08-07 21:15   ` Alan Stern
2026-08-07  7:54 ` Igor Skalkin [this message]
2026-08-07 21:19   ` [PATCH 2/4] usb: gadget: dummy_hcd: fix false overflow on bounded IN Alan Stern
2026-08-07  7:54 ` [PATCH 3/4] usb: gadget: dummy_hcd: fix SG transfer handling across chunks Igor Skalkin
2026-08-07 21:31   ` Alan Stern
2026-08-07  7:54 ` [PATCH 4/4] usb: gadget: dummy_hcd: set no_sg_constraint on the host controller Igor Skalkin
2026-08-07 21:23   ` 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=20260807075438.5566-3-igor.skalkin@oss.qualcomm.com \
    --to=igor.skalkin@oss.qualcomm.com \
    --cc=balbi@ti.com \
    --cc=bigeasy@linutronix.de \
    --cc=eeodqql09@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=surban@surban.net \
    --cc=tlinder@codeaurora.org \
    --cc=trilok.soni@oss.qualcomm.com \
    /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