linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] iwl4965: Add missing check for create_singlethread_workqueue
@ 2023-02-08  6:30 Jiasheng Jiang
  2023-02-08  6:30 ` [PATCH 2/2] iwl3945: " Jiasheng Jiang
  2023-02-08 20:16 ` [PATCH 1/2] iwl4965: " Stanislaw Gruszka
  0 siblings, 2 replies; 5+ messages in thread
From: Jiasheng Jiang @ 2023-02-08  6:30 UTC (permalink / raw)
  To: stf_xl, kvalo, davem, edumazet, kuba, pabeni
  Cc: linux-wireless, netdev, linux-kernel, Jiasheng Jiang

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

Fixes: b481de9ca074 ("[IWLWIFI]: add iwlwifi wireless drivers")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/net/wireless/intel/iwlegacy/4965-mac.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlegacy/4965-mac.c b/drivers/net/wireless/intel/iwlegacy/4965-mac.c
index 721b4042b4bf..841b4d5bd3b4 100644
--- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c
@@ -6211,10 +6211,12 @@ il4965_bg_txpower_work(struct work_struct *work)
 	mutex_unlock(&il->mutex);
 }
 
-static void
+static int
 il4965_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);
 
@@ -6233,6 +6235,8 @@ il4965_setup_deferred_work(struct il_priv *il)
 	timer_setup(&il->watchdog, il_bg_watchdog, 0);
 
 	tasklet_setup(&il->irq_tasklet, il4965_irq_tasklet);
+
+	return 0;
 }
 
 static void
@@ -6618,7 +6622,11 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		goto out_disable_msi;
 	}
 
-	il4965_setup_deferred_work(il);
+	err = il4965_setup_deferred_work(il);
+	if (err) {
+		goto out_free_irq;
+	}
+
 	il4965_setup_handlers(il);
 
 	/*********************************************
@@ -6656,6 +6664,7 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 out_destroy_workqueue:
 	destroy_workqueue(il->workqueue);
 	il->workqueue = NULL;
+out_free_irq:
 	free_irq(il->pci_dev->irq, il);
 out_disable_msi:
 	pci_disable_msi(il->pci_dev);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] iwl3945: Add missing check for create_singlethread_workqueue
  2023-02-08  6:30 [PATCH 1/2] iwl4965: Add missing check for create_singlethread_workqueue Jiasheng Jiang
@ 2023-02-08  6:30 ` Jiasheng Jiang
  2023-02-08 20:17   ` Stanislaw Gruszka
  2023-02-13 15:16   ` [2/2] wifi: " Kalle Valo
  2023-02-08 20:16 ` [PATCH 1/2] iwl4965: " Stanislaw Gruszka
  1 sibling, 2 replies; 5+ messages in thread
From: Jiasheng Jiang @ 2023-02-08  6:30 UTC (permalink / raw)
  To: stf_xl, kvalo, davem, edumazet, kuba, pabeni
  Cc: linux-wireless, netdev, linux-kernel, Jiasheng Jiang

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

Fixes: b481de9ca074 ("[IWLWIFI]: add iwlwifi wireless drivers")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/net/wireless/intel/iwlegacy/3945-mac.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlegacy/3945-mac.c b/drivers/net/wireless/intel/iwlegacy/3945-mac.c
index d7e99d50b287..9eaf5ec133f9 100644
--- a/drivers/net/wireless/intel/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/intel/iwlegacy/3945-mac.c
@@ -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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] iwl4965: Add missing check for create_singlethread_workqueue
  2023-02-08  6:30 [PATCH 1/2] iwl4965: Add missing check for create_singlethread_workqueue Jiasheng Jiang
  2023-02-08  6:30 ` [PATCH 2/2] iwl3945: " Jiasheng Jiang
@ 2023-02-08 20:16 ` Stanislaw Gruszka
  1 sibling, 0 replies; 5+ messages in thread
From: Stanislaw Gruszka @ 2023-02-08 20:16 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: kvalo, davem, edumazet, kuba, pabeni, linux-wireless, netdev,
	linux-kernel

On Wed, Feb 08, 2023 at 02:30:31PM +0800, Jiasheng Jiang wrote:
> Add the check for the return value of the create_singlethread_workqueue
> in order to avoid NULL pointer dereference.
> 
> Fixes: b481de9ca074 ("[IWLWIFI]: add iwlwifi wireless drivers")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>

>  static void
> @@ -6618,7 +6622,11 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  		goto out_disable_msi;
>  	}
>  
> -	il4965_setup_deferred_work(il);
> +	err = il4965_setup_deferred_work(il);
> +	if (err) {
> +		goto out_free_irq;
> +	}

{} not needded.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] iwl3945: Add missing check for create_singlethread_workqueue
  2023-02-08  6:30 ` [PATCH 2/2] iwl3945: " Jiasheng Jiang
@ 2023-02-08 20:17   ` Stanislaw Gruszka
  2023-02-13 15:16   ` [2/2] wifi: " Kalle Valo
  1 sibling, 0 replies; 5+ messages in thread
From: Stanislaw Gruszka @ 2023-02-08 20:17 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: kvalo, davem, edumazet, kuba, pabeni, linux-wireless, netdev,
	linux-kernel

On Wed, Feb 08, 2023 at 02:30:32PM +0800, Jiasheng Jiang wrote:
> Add the check for the return value of the create_singlethread_workqueue
> in order to avoid NULL pointer dereference.
> 
> Fixes: b481de9ca074 ("[IWLWIFI]: add iwlwifi wireless drivers")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [2/2] wifi: iwl3945: Add missing check for create_singlethread_workqueue
  2023-02-08  6:30 ` [PATCH 2/2] iwl3945: " Jiasheng Jiang
  2023-02-08 20:17   ` Stanislaw Gruszka
@ 2023-02-13 15:16   ` Kalle Valo
  1 sibling, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2023-02-13 15:16 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: stf_xl, davem, edumazet, kuba, pabeni, linux-wireless, netdev,
	linux-kernel, Jiasheng Jiang

Jiasheng Jiang <jiasheng@iscas.ac.cn> wrote:

> Add the check for the return value of the create_singlethread_workqueue
> in order to avoid NULL pointer dereference.
> 
> Fixes: b481de9ca074 ("[IWLWIFI]: add iwlwifi wireless drivers")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>

Patch applied to wireless-next.git, thanks.

1fdeb8b9f29d wifi: iwl3945: Add missing check for create_singlethread_workqueue

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20230208063032.42763-2-jiasheng@iscas.ac.cn/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-02-13 15:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-08  6:30 [PATCH 1/2] iwl4965: Add missing check for create_singlethread_workqueue Jiasheng Jiang
2023-02-08  6:30 ` [PATCH 2/2] iwl3945: " Jiasheng Jiang
2023-02-08 20:17   ` Stanislaw Gruszka
2023-02-13 15:16   ` [2/2] wifi: " Kalle Valo
2023-02-08 20:16 ` [PATCH 1/2] iwl4965: " Stanislaw Gruszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).