* [PATCH] wifi: rtw89: Add missing check for alloc_workqueue
@ 2023-01-04 14:23 Jiasheng Jiang
2023-01-05 9:09 ` Leon Romanovsky
0 siblings, 1 reply; 4+ messages in thread
From: Jiasheng Jiang @ 2023-01-04 14:23 UTC (permalink / raw)
To: leon
Cc: pkshih, kvalo, davem, edumazet, kuba, pabeni, linux-wireless,
netdev, linux-kernel, Jiasheng Jiang
On Wed, Jan 04, 2023 at 07:41:36PM +0800, Leon Romanovsky wrote:
> On Wed, Jan 04, 2023 at 05:33:53PM +0800, Jiasheng Jiang wrote:
>> Add check for the return value of alloc_workqueue since it may return
>> NULL pointer.
>>
>> Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")
>> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
>> ---
>> drivers/net/wireless/realtek/rtw89/core.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
>> index 931aff8b5dc9..006fe0499f81 100644
>> --- a/drivers/net/wireless/realtek/rtw89/core.c
>> +++ b/drivers/net/wireless/realtek/rtw89/core.c
>> @@ -3124,6 +3124,8 @@ int rtw89_core_init(struct rtw89_dev *rtwdev)
>> INIT_DELAYED_WORK(&rtwdev->cfo_track_work, rtw89_phy_cfo_track_work);
>> INIT_DELAYED_WORK(&rtwdev->forbid_ba_work, rtw89_forbid_ba_work);
>> rtwdev->txq_wq = alloc_workqueue("rtw89_tx_wq", WQ_UNBOUND | WQ_HIGHPRI, 0);
>> + if (!rtwdev->txq_wq)
>> + return -ENOMEM;
>
> While the change is fixing one issue, you are adding another one.
> There is no destroy of this workqueue if rtw89_load_firmware fails.
Actually, I do not think the missing of destroy_workqueue is introduced by me.
Even without my patch, the destroy_workqueue is still missing.
Anyway, I will submit a v2 that adds the missing destroy_workqueue.
Thanks,
Jiang
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] wifi: rtw89: Add missing check for alloc_workqueue
2023-01-04 14:23 [PATCH] wifi: rtw89: Add missing check for alloc_workqueue Jiasheng Jiang
@ 2023-01-05 9:09 ` Leon Romanovsky
0 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2023-01-05 9:09 UTC (permalink / raw)
To: Jiasheng Jiang
Cc: pkshih, kvalo, davem, edumazet, kuba, pabeni, linux-wireless,
netdev, linux-kernel
On Wed, Jan 04, 2023 at 10:23:53PM +0800, Jiasheng Jiang wrote:
> On Wed, Jan 04, 2023 at 07:41:36PM +0800, Leon Romanovsky wrote:
> > On Wed, Jan 04, 2023 at 05:33:53PM +0800, Jiasheng Jiang wrote:
> >> Add check for the return value of alloc_workqueue since it may return
> >> NULL pointer.
> >>
> >> Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")
> >> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> >> ---
> >> drivers/net/wireless/realtek/rtw89/core.c | 2 ++
> >> 1 file changed, 2 insertions(+)
> >>
> >> diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
> >> index 931aff8b5dc9..006fe0499f81 100644
> >> --- a/drivers/net/wireless/realtek/rtw89/core.c
> >> +++ b/drivers/net/wireless/realtek/rtw89/core.c
> >> @@ -3124,6 +3124,8 @@ int rtw89_core_init(struct rtw89_dev *rtwdev)
> >> INIT_DELAYED_WORK(&rtwdev->cfo_track_work, rtw89_phy_cfo_track_work);
> >> INIT_DELAYED_WORK(&rtwdev->forbid_ba_work, rtw89_forbid_ba_work);
> >> rtwdev->txq_wq = alloc_workqueue("rtw89_tx_wq", WQ_UNBOUND | WQ_HIGHPRI, 0);
> >> + if (!rtwdev->txq_wq)
> >> + return -ENOMEM;
> >
> > While the change is fixing one issue, you are adding another one.
> > There is no destroy of this workqueue if rtw89_load_firmware fails.
>
> Actually, I do not think the missing of destroy_workqueue is introduced by me.
> Even without my patch, the destroy_workqueue is still missing.
Not really, without your change, rtw89_core_init() never failed.
> Anyway, I will submit a v2 that adds the missing destroy_workqueue.
Thanks
>
> Thanks,
> Jiang
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] wifi: rtw89: Add missing check for alloc_workqueue
2023-01-04 9:33 Jiasheng Jiang
@ 2023-01-04 11:41 ` Leon Romanovsky
0 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2023-01-04 11:41 UTC (permalink / raw)
To: Jiasheng Jiang
Cc: pkshih, kvalo, davem, edumazet, kuba, pabeni, linux-wireless,
netdev, linux-kernel
On Wed, Jan 04, 2023 at 05:33:53PM +0800, Jiasheng Jiang wrote:
> Add check for the return value of alloc_workqueue since it may return
> NULL pointer.
>
> Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
> drivers/net/wireless/realtek/rtw89/core.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
> index 931aff8b5dc9..006fe0499f81 100644
> --- a/drivers/net/wireless/realtek/rtw89/core.c
> +++ b/drivers/net/wireless/realtek/rtw89/core.c
> @@ -3124,6 +3124,8 @@ int rtw89_core_init(struct rtw89_dev *rtwdev)
> INIT_DELAYED_WORK(&rtwdev->cfo_track_work, rtw89_phy_cfo_track_work);
> INIT_DELAYED_WORK(&rtwdev->forbid_ba_work, rtw89_forbid_ba_work);
> rtwdev->txq_wq = alloc_workqueue("rtw89_tx_wq", WQ_UNBOUND | WQ_HIGHPRI, 0);
> + if (!rtwdev->txq_wq)
> + return -ENOMEM;
While the change is fixing one issue, you are adding another one.
There is no destroy of this workqueue if rtw89_load_firmware fails.
Thanks
> spin_lock_init(&rtwdev->ba_lock);
> spin_lock_init(&rtwdev->rpwm_lock);
> mutex_init(&rtwdev->mutex);
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] wifi: rtw89: Add missing check for alloc_workqueue
@ 2023-01-04 9:33 Jiasheng Jiang
2023-01-04 11:41 ` Leon Romanovsky
0 siblings, 1 reply; 4+ messages in thread
From: Jiasheng Jiang @ 2023-01-04 9:33 UTC (permalink / raw)
To: pkshih, kvalo, davem, edumazet, kuba, pabeni
Cc: linux-wireless, netdev, linux-kernel, Jiasheng Jiang
Add check for the return value of alloc_workqueue since it may return
NULL pointer.
Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
drivers/net/wireless/realtek/rtw89/core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
index 931aff8b5dc9..006fe0499f81 100644
--- a/drivers/net/wireless/realtek/rtw89/core.c
+++ b/drivers/net/wireless/realtek/rtw89/core.c
@@ -3124,6 +3124,8 @@ int rtw89_core_init(struct rtw89_dev *rtwdev)
INIT_DELAYED_WORK(&rtwdev->cfo_track_work, rtw89_phy_cfo_track_work);
INIT_DELAYED_WORK(&rtwdev->forbid_ba_work, rtw89_forbid_ba_work);
rtwdev->txq_wq = alloc_workqueue("rtw89_tx_wq", WQ_UNBOUND | WQ_HIGHPRI, 0);
+ if (!rtwdev->txq_wq)
+ return -ENOMEM;
spin_lock_init(&rtwdev->ba_lock);
spin_lock_init(&rtwdev->rpwm_lock);
mutex_init(&rtwdev->mutex);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-01-05 9:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-04 14:23 [PATCH] wifi: rtw89: Add missing check for alloc_workqueue Jiasheng Jiang
2023-01-05 9:09 ` Leon Romanovsky
-- strict thread matches above, loose matches on Subject: below --
2023-01-04 9:33 Jiasheng Jiang
2023-01-04 11:41 ` Leon Romanovsky
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).