* [PATCH] scsi: lpfc: check the return value of alloc_workqueue()
@ 2022-07-23 6:40 williamsukatube
2022-07-28 19:52 ` James Smart
0 siblings, 1 reply; 2+ messages in thread
From: williamsukatube @ 2022-07-23 6:40 UTC (permalink / raw)
To: jejb, martin.petersen, linux-scsi, linux-kernel
Cc: james.smart, dick.kennedy, William Dean, Hacash Robot
From: William Dean <williamsukatube@gmail.com>
The function alloc_workqueue() in lpfc_sli4_driver_resource_setup() can
fail, but there is no check of its return value. To fix this bug, its
return value should be checked with new error handling code.
Fixes: 3cee98db2610f ("scsi: lpfc: Fix crash on driver unload in wq free")
Reported-by: Hacash Robot <hacashRobot@santino.com>
Signed-off-by: William Dean <williamsukatube@gmail.com>
---
drivers/scsi/lpfc/lpfc_init.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 750dd1e9f2cc..8e9594f4ed16 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -7958,6 +7958,8 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
/* The lpfc_wq workqueue for deferred irq use */
phba->wq = alloc_workqueue("lpfc_wq", WQ_MEM_RECLAIM, 0);
+ if (!phba->wq)
+ return -ENOMEM;
/*
* Initialize timers used by driver
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] scsi: lpfc: check the return value of alloc_workqueue()
2022-07-23 6:40 [PATCH] scsi: lpfc: check the return value of alloc_workqueue() williamsukatube
@ 2022-07-28 19:52 ` James Smart
0 siblings, 0 replies; 2+ messages in thread
From: James Smart @ 2022-07-28 19:52 UTC (permalink / raw)
To: williamsukatube, jejb, martin.petersen, linux-scsi, linux-kernel
Cc: james.smart, dick.kennedy, William Dean, Hacash Robot
On 7/22/2022 11:40 PM, williamsukatube@163.com wrote:
> From: William Dean <williamsukatube@gmail.com>
>
> The function alloc_workqueue() in lpfc_sli4_driver_resource_setup() can
> fail, but there is no check of its return value. To fix this bug, its
> return value should be checked with new error handling code.
>
> Fixes: 3cee98db2610f ("scsi: lpfc: Fix crash on driver unload in wq free")
> Reported-by: Hacash Robot <hacashRobot@santino.com>
> Signed-off-by: William Dean <williamsukatube@gmail.com>
> ---
> drivers/scsi/lpfc/lpfc_init.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
> index 750dd1e9f2cc..8e9594f4ed16 100644
> --- a/drivers/scsi/lpfc/lpfc_init.c
> +++ b/drivers/scsi/lpfc/lpfc_init.c
> @@ -7958,6 +7958,8 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
>
> /* The lpfc_wq workqueue for deferred irq use */
> phba->wq = alloc_workqueue("lpfc_wq", WQ_MEM_RECLAIM, 0);
> + if (!phba->wq)
> + return -ENOMEM;
>
> /*
> * Initialize timers used by driver
Reviewed-by: James Smart <jsmart2021@gmail.com>
-- james
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-28 19:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-23 6:40 [PATCH] scsi: lpfc: check the return value of alloc_workqueue() williamsukatube
2022-07-28 19:52 ` James Smart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®