scsi: qla2xxx: Fix end of loop test
authorDan Carpenter <dan.carpenter@linaro.org>
Mon, 22 May 2023 11:09:17 +0000 (14:09 +0300)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 31 May 2023 15:19:20 +0000 (11:19 -0400)
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>
Link: https://lore.kernel.org/r/cea5a62f-b873-4347-8f8e-c67527ced8d2@kili.mountain
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_os.c

index bc89d3da8fd0d251d02632a8d9a7cae3839e171e..952fd2b5e6da5f3862b8c9a55b765981b6a12e1e 100644 (file)
@@ -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;