* [PATCH -next v2] scsi: lpfc: add missing destroy_workqueue() on error path in lpfc_sli4_driver_resource_setup()
@ 2022-08-23 4:42 Yang Yingliang
2022-08-23 13:22 ` James Smart
2022-09-01 5:12 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Yang Yingliang @ 2022-08-23 4:42 UTC (permalink / raw)
To: linux-kernel, linux-scsi, martin.petersen; +Cc: james.smart, dick.kennedy
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")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
v2:
correct label spelling error
---
drivers/scsi/lpfc/lpfc_init.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index c69c5a0979ec..55a1ad6eed03 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -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;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next v2] scsi: lpfc: add missing destroy_workqueue() on error path in lpfc_sli4_driver_resource_setup()
2022-08-23 4:42 [PATCH -next v2] scsi: lpfc: add missing destroy_workqueue() on error path in lpfc_sli4_driver_resource_setup() Yang Yingliang
@ 2022-08-23 13:22 ` James Smart
2022-09-01 5:12 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: James Smart @ 2022-08-23 13:22 UTC (permalink / raw)
To: Yang Yingliang, linux-kernel, linux-scsi, martin.petersen
Cc: james.smart, dick.kennedy
On 8/22/2022 9:42 PM, Yang Yingliang wrote:
> 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")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> v2:
> correct label spelling error
> ---
> drivers/scsi/lpfc/lpfc_init.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
> index c69c5a0979ec..55a1ad6eed03 100644
> --- a/drivers/scsi/lpfc/lpfc_init.c
> +++ b/drivers/scsi/lpfc/lpfc_init.c
> @@ -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;
> }
>
Thank You!
Reviewed-by: James Smart <jsmart2021@gmail.com>
-- james
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next v2] scsi: lpfc: add missing destroy_workqueue() on error path in lpfc_sli4_driver_resource_setup()
2022-08-23 4:42 [PATCH -next v2] scsi: lpfc: add missing destroy_workqueue() on error path in lpfc_sli4_driver_resource_setup() Yang Yingliang
2022-08-23 13:22 ` James Smart
@ 2022-09-01 5:12 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2022-09-01 5:12 UTC (permalink / raw)
To: linux-kernel, Yang Yingliang, linux-scsi
Cc: Martin K . Petersen, james.smart, dick.kennedy
On Tue, 23 Aug 2022 12:42:37 +0800, Yang Yingliang wrote:
> Add the missing destroy_workqueue() before return from
> lpfc_sli4_driver_resource_setup() in error path.
>
>
Applied to 6.0/scsi-fixes, thanks!
[1/1] scsi: lpfc: add missing destroy_workqueue() on error path in lpfc_sli4_driver_resource_setup()
https://git.kernel.org/mkp/scsi/c/da6d507f5ff3
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-01 5:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-23 4:42 [PATCH -next v2] scsi: lpfc: add missing destroy_workqueue() on error path in lpfc_sli4_driver_resource_setup() Yang Yingliang
2022-08-23 13:22 ` James Smart
2022-09-01 5:12 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).