Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7e594abc authored by Jiasheng Jiang's avatar Jiasheng Jiang Committed by Greg Kroah-Hartman
Browse files

wifi: iwl3945: Add missing check for create_singlethread_workqueue



[ Upstream commit 1fdeb8b9f29dfd64805bb49475ac7566a3cb06cb ]

Add the check for the return value of the create_singlethread_workqueue
in order to avoid NULL pointer dereference.

Fixes: b481de9c ("[IWLWIFI]: add iwlwifi wireless drivers")
Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
Acked-by: default avatarStanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230208063032.42763-2-jiasheng@iscas.ac.cn


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 5de7a425
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -3382,10 +3382,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);

@@ -3404,6 +3406,8 @@ il3945_setup_deferred_work(struct il_priv *il)
	tasklet_init(&il->irq_tasklet,
		     il3945_irq_tasklet,
		     (unsigned long)il);

	return 0;
}

static void
@@ -3725,7 +3729,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);

@@ -3737,7 +3744,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);

@@ -3746,9 +3753,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);