drivers/scsi/scsi_transport_sas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
After the commit 37c4e72b0651 ("scsi: Fix sas_user_scan() to handle
wildcard and multi-channel scans"), if the device supports multiple
channels (0 to shost->max_channel), user_scan() invokes updated
sas_user_scan() to perform the scan behavior for a specific transfer.
However, when the user specifies shost->max_channel, it will return
-EINVAL, which is not expected.
Fix and support specifying the scan shost->max_channel for scanning.
Changes since v1:
- Add the prefix "scsi_transport_sas".
Fixes: 37c4e72b0651 ("scsi: Fix sas_user_scan() to handle wildcard and multi-channel scans")
Signed-off-by: Yihang Li <liyihang9@huawei.com>
---
drivers/scsi/scsi_transport_sas.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index 12124f9d5ccd..13412702188e 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -1734,7 +1734,7 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel,
break;
default:
- if (channel < shost->max_channel) {
+ if (channel <= shost->max_channel) {
res = scsi_scan_host_selected(shost, channel, id, lun,
SCSI_SCAN_MANUAL);
} else {
--
2.33.0
On Tue, 17 Mar 2026 14:31:47 +0800, Yihang Li wrote:
> After the commit 37c4e72b0651 ("scsi: Fix sas_user_scan() to handle
> wildcard and multi-channel scans"), if the device supports multiple
> channels (0 to shost->max_channel), user_scan() invokes updated
> sas_user_scan() to perform the scan behavior for a specific transfer.
> However, when the user specifies shost->max_channel, it will return
> -EINVAL, which is not expected.
>
> [...]
Applied to 7.0/scsi-fixes, thanks!
[1/1] scsi: scsi_transport_sas: Fix the maximum channel scanning issue
https://git.kernel.org/mkp/scsi/c/d71afa9deb4d
--
Martin K. Petersen
On 17/03/2026 06:31, Yihang Li wrote:
> After the commit 37c4e72b0651 ("scsi: Fix sas_user_scan() to handle
> wildcard and multi-channel scans"), if the device supports multiple
> channels (0 to shost->max_channel), user_scan() invokes updated
> sas_user_scan() to perform the scan behavior for a specific transfer.
> However, when the user specifies shost->max_channel, it will return
> -EINVAL, which is not expected.
>
> Fix and support specifying the scan shost->max_channel for scanning.
>
> Changes since v1:
> - Add the prefix "scsi_transport_sas".
this belongs "below the line"
>
> Fixes: 37c4e72b0651 ("scsi: Fix sas_user_scan() to handle wildcard and multi-channel scans")
> Signed-off-by: Yihang Li<liyihang9@huawei.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
© 2016 - 2026 Red Hat, Inc.