Skip to content

Commit d4d10e5

Browse files
JiangJiasedoardocanepa
authored andcommitted
iwlwifi: Add missing check for alloc_ordered_workqueue
BugLink: https://bugs.launchpad.net/bugs/2126463 [ Upstream commit 90a0d9f339960448a3acc1437a46730f975efd6a ] Add check for the return value of alloc_ordered_workqueue since it may return NULL pointer. Fixes: b481de9 ("[IWLWIFI]: add iwlwifi wireless drivers") Signed-off-by: Jiasheng Jiang <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Miri Korenblit <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Noah Wager <[email protected]> Signed-off-by: Edoardo Canepa <[email protected]>
1 parent 4dc6e0f commit d4d10e5

File tree

1 file changed

+9
-2
lines changed
  • drivers/net/wireless/intel/iwlwifi/dvm

1 file changed

+9
-2
lines changed

drivers/net/wireless/intel/iwlwifi/dvm/main.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,9 +1048,11 @@ static void iwl_bg_restart(struct work_struct *data)
10481048
*
10491049
*****************************************************************************/
10501050

1051-
static void iwl_setup_deferred_work(struct iwl_priv *priv)
1051+
static int iwl_setup_deferred_work(struct iwl_priv *priv)
10521052
{
10531053
priv->workqueue = alloc_ordered_workqueue(DRV_NAME, 0);
1054+
if (!priv->workqueue)
1055+
return -ENOMEM;
10541056

10551057
INIT_WORK(&priv->restart, iwl_bg_restart);
10561058
INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update);
@@ -1067,6 +1069,8 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv)
10671069
timer_setup(&priv->statistics_periodic, iwl_bg_statistics_periodic, 0);
10681070

10691071
timer_setup(&priv->ucode_trace, iwl_bg_ucode_trace, 0);
1072+
1073+
return 0;
10701074
}
10711075

10721076
void iwl_cancel_deferred_work(struct iwl_priv *priv)
@@ -1464,7 +1468,9 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
14641468
/********************
14651469
* 6. Setup services
14661470
********************/
1467-
iwl_setup_deferred_work(priv);
1471+
if (iwl_setup_deferred_work(priv))
1472+
goto out_uninit_drv;
1473+
14681474
iwl_setup_rx_handlers(priv);
14691475

14701476
iwl_power_initialize(priv);
@@ -1503,6 +1509,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
15031509
iwl_cancel_deferred_work(priv);
15041510
destroy_workqueue(priv->workqueue);
15051511
priv->workqueue = NULL;
1512+
out_uninit_drv:
15061513
iwl_uninit_drv(priv);
15071514
out_free_eeprom_blob:
15081515
kfree(priv->eeprom_blob);

0 commit comments

Comments
 (0)