Linux USB
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	luca.cecchi.info@gmail.com
Cc: Oliver Neukum <oneukum@suse.com>
Subject: [PATCH] usb: uas: do not leak error codes from usb_alloc_streams()
Date: Thu,  8 Oct 2026 15:27:11 +0200	[thread overview]
Message-ID: <20261008132711.211908-1-oneukum@suse.com> (raw)

While a UAS device is undergoing a reset not triggered by
the SCSI layer there is a short window in the error case
of reallocating streams during which internal error codes
of the USB layer are exported as nonsensical queue depths.

The error has been noticed by Sashiko in a different
context, but it is a general issue.

Fixes: 4de7a3735bdc4 ("uas: Fix reset handling for externally triggered reset")
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/usb/storage/uas.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 265162981269..3f69e9de9b61 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -983,10 +983,12 @@ static int uas_configure_endpoints(struct uas_dev_info *devinfo)
 		devinfo->qdepth = 32;
 		devinfo->use_streams = 0;
 	} else {
-		devinfo->qdepth = usb_alloc_streams(devinfo->intf, eps + 1,
+		r = usb_alloc_streams(devinfo->intf, eps + 1,
 						    3, MAX_CMNDS, GFP_NOIO);
-		if (devinfo->qdepth < 0)
-			return devinfo->qdepth;
+		if (r < 0)
+			return r;
+
+		devinfo->qdepth = r;
 		devinfo->use_streams = 1;
 	}
 
-- 
2.55.0


             reply	other threads:[~2026-10-08 13:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08 13:27 Oliver Neukum [this message]
2026-10-08 13:45 ` [PATCH] usb: uas: do not leak error codes from usb_alloc_streams() sashiko-bot
2026-10-08 16:23 ` Sergey Shtylyov

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=20261008132711.211908-1-oneukum@suse.com \
    --to=oneukum@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=luca.cecchi.info@gmail.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