mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
wifi: iwl3945: Add missing check for create_singlethread_workqueue
Add the check for the return value of the create_singlethread_workqueue
in order to avoid NULL pointer dereference.
Fixes: b481de9ca0
("[IWLWIFI]: add iwlwifi wireless drivers")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230208063032.42763-2-jiasheng@iscas.ac.cn
This commit is contained in:
parent
24d54855ff
commit
1fdeb8b9f2
1 changed files with 12 additions and 4 deletions
|
@ -3372,10 +3372,12 @@ static DEVICE_ATTR(dump_errors, 0200, NULL, il3945_dump_error_log);
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
static void
|
||||
static int
|
||||
il3945_setup_deferred_work(struct il_priv *il)
|
||||
{
|
||||
il->workqueue = create_singlethread_workqueue(DRV_NAME);
|
||||
if (!il->workqueue)
|
||||
return -ENOMEM;
|
||||
|
||||
init_waitqueue_head(&il->wait_command_queue);
|
||||
|
||||
|
@ -3392,6 +3394,8 @@ il3945_setup_deferred_work(struct il_priv *il)
|
|||
timer_setup(&il->watchdog, il_bg_watchdog, 0);
|
||||
|
||||
tasklet_setup(&il->irq_tasklet, il3945_irq_tasklet);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3712,7 +3716,10 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
}
|
||||
|
||||
il_set_rxon_channel(il, &il->bands[NL80211_BAND_2GHZ].channels[5]);
|
||||
il3945_setup_deferred_work(il);
|
||||
err = il3945_setup_deferred_work(il);
|
||||
if (err)
|
||||
goto out_remove_sysfs;
|
||||
|
||||
il3945_setup_handlers(il);
|
||||
il_power_initialize(il);
|
||||
|
||||
|
@ -3724,7 +3731,7 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
|
||||
err = il3945_setup_mac(il);
|
||||
if (err)
|
||||
goto out_remove_sysfs;
|
||||
goto out_destroy_workqueue;
|
||||
|
||||
il_dbgfs_register(il, DRV_NAME);
|
||||
|
||||
|
@ -3733,9 +3740,10 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
|
||||
return 0;
|
||||
|
||||
out_remove_sysfs:
|
||||
out_destroy_workqueue:
|
||||
destroy_workqueue(il->workqueue);
|
||||
il->workqueue = NULL;
|
||||
out_remove_sysfs:
|
||||
sysfs_remove_group(&pdev->dev.kobj, &il3945_attribute_group);
|
||||
out_release_irq:
|
||||
free_irq(il->pci_dev->irq, il);
|
||||
|
|
Loading…
Add table
Reference in a new issue