Skip to content

Commit a82268b

Browse files
insuyundledford
authored andcommitted
nes: handling failed allocation when creating workqueue
Since create_singlethread_workqueue uses kzalloc internally, it can fail when the system is under memory pressure, so need to handle it. Signed-off-by: Insu Yun <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent bfec53c commit a82268b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/infiniband/hw/nes/nes_cm.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2856,12 +2856,22 @@ static struct nes_cm_core *nes_cm_alloc_core(void)
28562856

28572857
nes_debug(NES_DBG_CM, "Enable QUEUE EVENTS\n");
28582858
cm_core->event_wq = create_singlethread_workqueue("nesewq");
2859+
if (!cm_core->event_wq)
2860+
goto out_free_cmcore;
28592861
cm_core->post_event = nes_cm_post_event;
28602862
nes_debug(NES_DBG_CM, "Enable QUEUE DISCONNECTS\n");
28612863
cm_core->disconn_wq = create_singlethread_workqueue("nesdwq");
2864+
if (!cm_core->disconn_wq)
2865+
goto out_free_wq;
28622866

28632867
print_core(cm_core);
28642868
return cm_core;
2869+
2870+
out_free_wq:
2871+
destroy_workqueue(cm_core->event_wq);
2872+
out_free_cmcore:
2873+
kfree(cm_core);
2874+
return NULL;
28652875
}
28662876

28672877

0 commit comments

Comments
 (0)