* [PATCH] usb: uas: do not leak error codes from usb_alloc_streams()
@ 2026-10-08 13:27 Oliver Neukum
2026-10-08 13:45 ` sashiko-bot
2026-10-08 16:23 ` Sergey Shtylyov
0 siblings, 2 replies; 3+ messages in thread
From: Oliver Neukum @ 2026-10-08 13:27 UTC (permalink / raw)
To: gregkh, linux-usb, luca.cecchi.info; +Cc: Oliver Neukum
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] usb: uas: do not leak error codes from usb_alloc_streams()
2026-10-08 13:27 [PATCH] usb: uas: do not leak error codes from usb_alloc_streams() Oliver Neukum
@ 2026-10-08 13:45 ` sashiko-bot
2026-10-08 16:23 ` Sergey Shtylyov
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-10-08 13:45 UTC (permalink / raw)
To: Oliver Neukum; +Cc: linux-usb
> 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>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261008132711.211908-1-oneukum@suse.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] usb: uas: do not leak error codes from usb_alloc_streams()
2026-10-08 13:27 [PATCH] usb: uas: do not leak error codes from usb_alloc_streams() Oliver Neukum
2026-10-08 13:45 ` sashiko-bot
@ 2026-10-08 16:23 ` Sergey Shtylyov
1 sibling, 0 replies; 3+ messages in thread
From: Sergey Shtylyov @ 2026-10-08 16:23 UTC (permalink / raw)
To: Oliver Neukum, gregkh, linux-usb, luca.cecchi.info
On 10/8/26 4:27 PM, Oliver Neukum wrote:
> 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);
This line now needs to be realigned...
[...]
MBR, Sergey
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-08 16:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-08 13:27 [PATCH] usb: uas: do not leak error codes from usb_alloc_streams() Oliver Neukum
2026-10-08 13:45 ` sashiko-bot
2026-10-08 16:23 ` Sergey Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox