scsi: qla2xxx: Fix gpnid error processing
authorQuinn Tran <quinn.tran@cavium.com>
Mon, 4 Dec 2017 22:44:57 +0000 (14:44 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 8 Dec 2017 02:07:00 +0000 (21:07 -0500)
Stop GPNID command from advancing if command has failed.

Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
Cc: <stable@vger.kernel.org> # 4.10+
Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_gs.c

index bc3db6abc9a0ba3985befc378ae8dd2cb452652a..ddc69d36877eaff7412236df5be2df03198aa094 100644 (file)
@@ -3211,6 +3211,11 @@ static void qla2x00_async_gpnid_sp_done(void *s, int res)
            sp->name, res, ct_req->req.port_id.port_id,
            ct_rsp->rsp.gpn_id.port_name);
 
+       if (res) {
+               sp->free(sp);
+               return;
+       }
+
        memset(&ea, 0, sizeof(ea));
        memcpy(ea.port_name, ct_rsp->rsp.gpn_id.port_name, WWN_SIZE);
        ea.sp = sp;