netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtw88: check the return value of alloc_workqueue()
@ 2022-07-23  6:37 williamsukatube
  2022-07-26  2:38 ` Ping-Ke Shih
  2022-07-29 13:35 ` wifi: " Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: williamsukatube @ 2022-07-23  6:37 UTC (permalink / raw)
  To: tony0620emma, kvalo, davem, edumazet, kuba, pabeni,
	linux-wireless, netdev, linux-kernel
  Cc: William Dean, Hacash Robot

From: William Dean <williamsukatube@gmail.com>

The function alloc_workqueue() in rtw_core_init() can fail, but
there is no check of its return value. To fix this bug, its return value
should be checked with new error handling code.

Fixes: fe101716c7c9d ("rtw88: replace tx tasklet with work queue")
Reported-by: Hacash Robot <hacashRobot@santino.com>
Signed-off-by: William Dean <williamsukatube@gmail.com>
---
 drivers/net/wireless/realtek/rtw88/main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index efabd5b1bf5b..645ef1d01895 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -1984,6 +1984,10 @@ int rtw_core_init(struct rtw_dev *rtwdev)
 	timer_setup(&rtwdev->tx_report.purge_timer,
 		    rtw_tx_report_purge_timer, 0);
 	rtwdev->tx_wq = alloc_workqueue("rtw_tx_wq", WQ_UNBOUND | WQ_HIGHPRI, 0);
+	if (!rtwdev->tx_wq) {
+		rtw_warn(rtwdev, "alloc_workqueue rtw_tx_wq failed\n");
+		return -ENOMEM;
+	}
 
 	INIT_DELAYED_WORK(&rtwdev->watch_dog_work, rtw_watch_dog_work);
 	INIT_DELAYED_WORK(&coex->bt_relink_work, rtw_coex_bt_relink_work);
-- 
2.25.1


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

* RE: [PATCH] rtw88: check the return value of alloc_workqueue()
  2022-07-23  6:37 [PATCH] rtw88: check the return value of alloc_workqueue() williamsukatube
@ 2022-07-26  2:38 ` Ping-Ke Shih
  2022-07-29 13:35 ` wifi: " Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2022-07-26  2:38 UTC (permalink / raw)
  To: williamsukatube, tony0620emma, kvalo, davem, edumazet, kuba,
	pabeni, linux-wireless, netdev, linux-kernel
  Cc: William Dean, Hacash Robot


> -----Original Message-----
> From: williamsukatube@163.com <williamsukatube@163.com>
> Sent: Saturday, July 23, 2022 2:38 PM
> To: tony0620emma@gmail.com; kvalo@kernel.org; davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> pabeni@redhat.com; linux-wireless@vger.kernel.org; netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Cc: William Dean <williamsukatube@gmail.com>; Hacash Robot <hacashRobot@santino.com>
> Subject: [PATCH] rtw88: check the return value of alloc_workqueue()
> 
> From: William Dean <williamsukatube@gmail.com>
> 
> The function alloc_workqueue() in rtw_core_init() can fail, but
> there is no check of its return value. To fix this bug, its return value
> should be checked with new error handling code.
> 
> Fixes: fe101716c7c9d ("rtw88: replace tx tasklet with work queue")
> Reported-by: Hacash Robot <hacashRobot@santino.com>
> Signed-off-by: William Dean <williamsukatube@gmail.com>

Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>

Thank you

> ---
>  drivers/net/wireless/realtek/rtw88/main.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
> index efabd5b1bf5b..645ef1d01895 100644
> --- a/drivers/net/wireless/realtek/rtw88/main.c
> +++ b/drivers/net/wireless/realtek/rtw88/main.c
> @@ -1984,6 +1984,10 @@ int rtw_core_init(struct rtw_dev *rtwdev)
>  	timer_setup(&rtwdev->tx_report.purge_timer,
>  		    rtw_tx_report_purge_timer, 0);
>  	rtwdev->tx_wq = alloc_workqueue("rtw_tx_wq", WQ_UNBOUND | WQ_HIGHPRI, 0);
> +	if (!rtwdev->tx_wq) {
> +		rtw_warn(rtwdev, "alloc_workqueue rtw_tx_wq failed\n");
> +		return -ENOMEM;
> +	}
> 
>  	INIT_DELAYED_WORK(&rtwdev->watch_dog_work, rtw_watch_dog_work);
>  	INIT_DELAYED_WORK(&coex->bt_relink_work, rtw_coex_bt_relink_work);
> --
> 2.25.1


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

* Re: wifi: rtw88: check the return value of alloc_workqueue()
  2022-07-23  6:37 [PATCH] rtw88: check the return value of alloc_workqueue() williamsukatube
  2022-07-26  2:38 ` Ping-Ke Shih
@ 2022-07-29 13:35 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2022-07-29 13:35 UTC (permalink / raw)
  To: williamsukatube
  Cc: tony0620emma, davem, edumazet, kuba, pabeni, linux-wireless,
	netdev, linux-kernel, William Dean, Hacash Robot

williamsukatube@163.com wrote:

> From: William Dean <williamsukatube@gmail.com>
> 
> The function alloc_workqueue() in rtw_core_init() can fail, but
> there is no check of its return value. To fix this bug, its return value
> should be checked with new error handling code.
> 
> Fixes: fe101716c7c9d ("rtw88: replace tx tasklet with work queue")
> Reported-by: Hacash Robot <hacashRobot@santino.com>
> Signed-off-by: William Dean <williamsukatube@gmail.com>
> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>

Patch applied to wireless-next.git, thanks.

42bbf810e155 wifi: rtw88: check the return value of alloc_workqueue()

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20220723063756.2956189-1-williamsukatube@163.com/

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


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

end of thread, other threads:[~2022-07-29 13:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-23  6:37 [PATCH] rtw88: check the return value of alloc_workqueue() williamsukatube
2022-07-26  2:38 ` Ping-Ke Shih
2022-07-29 13:35 ` wifi: " Kalle Valo

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).