diff mbox series

scsi: qla2xxx: fix end of loop test

Message ID cea5a62f-b873-4347-8f8e-c67527ced8d2@kili.mountain (mailing list archive)
State Accepted
Commit 339020091e246e708c1381acf74c5f8e3fe4d2b5
Headers show
Series scsi: qla2xxx: fix end of loop test | expand

Commit Message

Dan Carpenter May 22, 2023, 11:09 a.m. UTC
This loop will exit successfully when "found" is false or in the failure
case it times out with "wait_iter" set to -1.  The test for timeouts is
impossible as is.

Fixes: b843adde8d49 ("scsi: qla2xxx: Fix mem access after free")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/scsi/qla2xxx/qla_os.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin K. Petersen May 31, 2023, 3:19 p.m. UTC | #1
Dan,

> This loop will exit successfully when "found" is false or in the
> failure case it times out with "wait_iter" set to -1. The test for
> timeouts is impossible as is.

Applied to 6.5/scsi-staging, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index bc89d3da8fd0..952fd2b5e6da 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1409,7 +1409,7 @@  __qla2x00_eh_wait_for_pending_commands(struct qla_qpair *qpair, unsigned int t,
 			break;
 	}
 
-	if (!wait_iter && found)
+	if (wait_iter == -1)
 		status = QLA_FUNCTION_FAILED;
 
 	return status;