scsi: libiscsi: Fix iSCSI host workq destruction
authorMike Christie <michael.christie@oracle.com>
Sun, 7 Feb 2021 04:46:03 +0000 (22:46 -0600)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 9 Feb 2021 03:39:04 +0000 (22:39 -0500)
We allocate the iSCSI host workq in iscsi_host_alloc() so iscsi_host_free()
should do the destruction. Drivers can then do their error/goto handling
and call iscsi_host_free() to clean up what has been allocated in
iscsi_host_alloc().

Link: https://lore.kernel.org/r/20210207044608.27585-5-michael.christie@oracle.com
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/libiscsi.c

index ec159bcb746057a9892e497eb9df6ae423df62d5..b271d3accd2af58ccf32418e2dbe8306a8d5f280 100644 (file)
@@ -2738,8 +2738,6 @@ void iscsi_host_remove(struct Scsi_Host *shost)
                flush_signals(current);
 
        scsi_remove_host(shost);
-       if (ihost->workq)
-               destroy_workqueue(ihost->workq);
 }
 EXPORT_SYMBOL_GPL(iscsi_host_remove);
 
@@ -2747,6 +2745,9 @@ void iscsi_host_free(struct Scsi_Host *shost)
 {
        struct iscsi_host *ihost = shost_priv(shost);
 
+       if (ihost->workq)
+               destroy_workqueue(ihost->workq);
+
        kfree(ihost->netdev);
        kfree(ihost->hwaddress);
        kfree(ihost->initiatorname);