Skip to contentSkip to conversation

scsi: lpfc: add missing destroy_workqueue() on error path in lpfc_sli4_driver_resource_setup()

PATCH Applied Yang Yingliang 3 participants 3 messages Aug 23, 2022 – Sep 1, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 scsi: lpfc: add missing destroy_workqueue() on error path in lpfc_sli4_driver_resource_setup()

Add the missing destroy_workqueue() before return from lpfc_sli4_driver_resource_setup() in error path.

Fixes 3cee98db2610 ("scsi: lpfc: Fix crash on driver unload in wq free")

---
v2:
correct label spelling error

---
 drivers/scsi/lpfc/lpfc_init.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_init.c +4 -1
index c69c5a0979ec..55a1ad6eed03 100644
@@ -8053,7 +8053,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
 	/* Allocate device driver memory */
 	rc = lpfc_mem_alloc(phba, SGL_ALIGN_SZ);
 	if (rc)
-		return -ENOMEM;
+		goto out_destroy_workqueue;
 
 	/* IF Type 2 ports get initialized now. */
 	if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >=
@@ -8481,6 +8481,9 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
 	lpfc_destroy_bootstrap_mbox(phba);
 out_free_mem:
 	lpfc_mem_free(phba);
+out_destroy_workqueue:
+	destroy_workqueue(phba->wq);
+	phba->wq = NULL;
 	return rc;
 }
 
Signature · 1 line
2.25.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 26 lines · Yang Yingliang

Add the missing destroy_workqueue() before return from lpfc_sli4_driver_resource_setup() in error path.

Fixes 3cee98db2610 ("scsi: lpfc: Fix crash on driver unload in wq free")

---
v2:
correct label spelling error

---
  drivers/scsi/lpfc/lpfc_init.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_init.c +1 -1
index c69c5a0979ec..55a1ad6eed03 100644
@@ -8053,7 +8053,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
  	/* Allocate device driver memory */
  	rc = lpfc_mem_alloc(phba, SGL_ALIGN_SZ);
  	if (rc)
-		return -ENOMEM;
+		goto out_destroy_workqueue;
 
  	/* IF Type 2 ports get initialized now. */
  	if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >=

drivers/scsi/lpfc/lpfc_init.c lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · line 8489

Quoted 9 lines
drivers/scsi/lpfc/lpfc_init.c +3 -0
@@ -8481,6 +8481,9 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
  	lpfc_destroy_bootstrap_mbox(phba);
  out_free_mem:
  	lpfc_mem_free(phba);
+out_destroy_workqueue:
+	destroy_workqueue(phba->wq);
+	phba->wq = NULL;
  	return rc;
  }
 

Thank You!

-- james