Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] scsi: Fix the maximum channel scanning issue
@ 2026-03-13  2:30 Yihang Li
  2026-03-16 17:22 ` Bart Van Assche
  0 siblings, 1 reply; 3+ messages in thread
From: Yihang Li @ 2026-03-13  2:30 UTC (permalink / raw)
  To: martin.petersen, James.Bottomley, ranjan.kumar
  Cc: linux-scsi, linux-kernel, liyihang9, liuyonglong, linuxarm

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.

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-17  6:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-13  2:30 [PATCH] scsi: Fix the maximum channel scanning issue Yihang Li
2026-03-16 17:22 ` Bart Van Assche
2026-03-17  6:24   ` Yihang Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox