[PATCH] scsi: qla2xxx: Fix BSG request hang on flash image validation failure

Guangshuo Li posted 1 patch an hour ago
drivers/scsi/qla2xxx/qla_bsg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] scsi: qla2xxx: Fix BSG request hang on flash image validation failure
Posted by Guangshuo Li an hour ago
qla28xx_validate_flash_image() validates a flash image and reports the
result through the BSG reply. It only calls bsg_job_done() when the
validation succeeds.

However, the function always returns QLA_SUCCESS. If validation fails,
bsg_job_done() is skipped but the zero return value tells the BSG core
that the request was accepted and will be completed asynchronously. No
one completes the request afterwards, so the BSG request remains
in-flight until it times out.

Return the validation error when bsg_job_done() is not called. This lets
the BSG core complete the request with an error instead of waiting for a
completion that will never happen.

Fixes: c2c68225b145 ("scsi: qla2xxx: Fix bsg_done() causing double free")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
 drivers/scsi/qla2xxx/qla_bsg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 5e910b5ca670..5b2201859f73 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -3369,5 +3369,5 @@ static int qla28xx_validate_flash_image(struct bsg_job *bsg_job)
 		bsg_job_done(bsg_job, bsg_reply->result,
 			     bsg_reply->reply_payload_rcv_len);
 
-	return QLA_SUCCESS;
+	return rval;
 }
-- 
2.43.0