scsi: esas2r: Add check for alloc_ordered_workqueue() return value
Subsystems (2)
PATCH 1/1 scsi: esas2r: Add check for alloc_ordered_workqueue() return value
alloc_ordered_workqueue() may return NULL. Failure to check this could lead to NULL pointer dereference.
Add return value check and call esas2r_kill_adapter() on failure to ensure proper cleanup.
Fixes 26780d9e12ed ("[SCSI] esas2r: ATTO Technology ExpressSAS 6G SAS/SATA RAID Adapter Driver")
Signed-off-by Haotian Zhang <[email protected]>
--- drivers/scsi/esas2r/esas2r_init.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/scsi/esas2r/esas2r_init.c +6 -0
@@ -313,6 +313,12 @@ int esas2r_init_adapter(struct Scsi_Host *host, struct pci_dev *pcid,esas2r_fw_event_off (a); a->fw_event_q =alloc_ordered_workqueue ("esas2r/%d" ,WQ_MEM_RECLAIM , a->index); +if (!a->fw_event_q) { +esas2r_log (ESAS2R_LOG_CRIT , +"failed to allocate fw_event workqueue!" ); +esas2r_kill_adapter (index); +return 0 ; + }init_waitqueue_head (&a->buffered_ioctl_waiter);init_waitqueue_head (&a->nvram_waiter);
Signature · 1 line
2.50.1.windows.1