Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wifi: mt76: connac: check for null before dereferencing
@ 2024-03-01 14:44 Muhammad Usama Anjum
  2024-03-04 10:17 ` AngeloGioacchino Del Regno
  2024-03-11 17:11 ` Muhammad Usama Anjum
  0 siblings, 2 replies; 5+ messages in thread
From: Muhammad Usama Anjum @ 2024-03-01 14:44 UTC (permalink / raw)
  To: Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen,
	Sean Wang, Kalle Valo, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: Muhammad Usama Anjum, kernel, kernel-janitors, linux-wireless,
	linux-kernel, linux-arm-kernel, linux-mediatek

The wcid can be NULL. It should be checked for validity before
dereferencing it to avoid crash.

Fixes: 098428c400ff ("wifi: mt76: connac: set correct muar_idx for mt799x chipsets")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
 drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
index af0c2b2aacb00..7af60eebe517a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
@@ -283,7 +283,7 @@ __mt76_connac_mcu_alloc_sta_req(struct mt76_dev *dev, struct mt76_vif *mvif,
 	};
 	struct sk_buff *skb;
 
-	if (is_mt799x(dev) && !wcid->sta)
+	if (is_mt799x(dev) && wcid && !wcid->sta)
 		hdr.muar_idx = 0xe;
 
 	mt76_connac_mcu_get_wlan_idx(dev, wcid, &hdr.wlan_idx_lo,
-- 
2.39.2



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

* Re: [PATCH] wifi: mt76: connac: check for null before dereferencing
  2024-03-01 14:44 [PATCH] wifi: mt76: connac: check for null before dereferencing Muhammad Usama Anjum
@ 2024-03-04 10:17 ` AngeloGioacchino Del Regno
  2024-03-11 17:11 ` Muhammad Usama Anjum
  1 sibling, 0 replies; 5+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-03-04 10:17 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Felix Fietkau, Lorenzo Bianconi, Ryder Lee,
	Shayne Chen, Sean Wang, Kalle Valo, Matthias Brugger
  Cc: kernel, kernel-janitors, linux-wireless, linux-kernel,
	linux-arm-kernel, linux-mediatek

Il 01/03/24 15:44, Muhammad Usama Anjum ha scritto:
> The wcid can be NULL. It should be checked for validity before
> dereferencing it to avoid crash.
> 
> Fixes: 098428c400ff ("wifi: mt76: connac: set correct muar_idx for mt799x chipsets")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>




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

* Re: [PATCH] wifi: mt76: connac: check for null before dereferencing
  2024-03-01 14:44 [PATCH] wifi: mt76: connac: check for null before dereferencing Muhammad Usama Anjum
  2024-03-04 10:17 ` AngeloGioacchino Del Regno
@ 2024-03-11 17:11 ` Muhammad Usama Anjum
  2024-04-04 11:49   ` Muhammad Usama Anjum
  1 sibling, 1 reply; 5+ messages in thread
From: Muhammad Usama Anjum @ 2024-03-11 17:11 UTC (permalink / raw)
  To: Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen,
	Sean Wang, Kalle Valo, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: Muhammad Usama Anjum, kernel, kernel-janitors, linux-wireless,
	linux-kernel, linux-arm-kernel, linux-mediatek

Soft reminder

On 3/1/24 7:44 PM, Muhammad Usama Anjum wrote:
> The wcid can be NULL. It should be checked for validity before
> dereferencing it to avoid crash.
> 
> Fixes: 098428c400ff ("wifi: mt76: connac: set correct muar_idx for mt799x chipsets")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> index af0c2b2aacb00..7af60eebe517a 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> @@ -283,7 +283,7 @@ __mt76_connac_mcu_alloc_sta_req(struct mt76_dev *dev, struct mt76_vif *mvif,
>  	};
>  	struct sk_buff *skb;
>  
> -	if (is_mt799x(dev) && !wcid->sta)
> +	if (is_mt799x(dev) && wcid && !wcid->sta)
>  		hdr.muar_idx = 0xe;
>  
>  	mt76_connac_mcu_get_wlan_idx(dev, wcid, &hdr.wlan_idx_lo,

-- 
BR,
Muhammad Usama Anjum


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

* Re: [PATCH] wifi: mt76: connac: check for null before dereferencing
  2024-03-11 17:11 ` Muhammad Usama Anjum
@ 2024-04-04 11:49   ` Muhammad Usama Anjum
  2024-04-04 11:51     ` Felix Fietkau
  0 siblings, 1 reply; 5+ messages in thread
From: Muhammad Usama Anjum @ 2024-04-04 11:49 UTC (permalink / raw)
  To: Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen,
	Sean Wang, Kalle Valo, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: Muhammad Usama Anjum, kernel, kernel-janitors, linux-wireless,
	linux-kernel, linux-arm-kernel, linux-mediatek

Soft reminder

On 3/11/24 10:11 PM, Muhammad Usama Anjum wrote:
> Soft reminder
> 
> On 3/1/24 7:44 PM, Muhammad Usama Anjum wrote:
>> The wcid can be NULL. It should be checked for validity before
>> dereferencing it to avoid crash.
>>
>> Fixes: 098428c400ff ("wifi: mt76: connac: set correct muar_idx for mt799x chipsets")
>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>> ---
>>  drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
>> index af0c2b2aacb00..7af60eebe517a 100644
>> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
>> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
>> @@ -283,7 +283,7 @@ __mt76_connac_mcu_alloc_sta_req(struct mt76_dev *dev, struct mt76_vif *mvif,
>>  	};
>>  	struct sk_buff *skb;
>>  
>> -	if (is_mt799x(dev) && !wcid->sta)
>> +	if (is_mt799x(dev) && wcid && !wcid->sta)
>>  		hdr.muar_idx = 0xe;
>>  
>>  	mt76_connac_mcu_get_wlan_idx(dev, wcid, &hdr.wlan_idx_lo,
> 

-- 
BR,
Muhammad Usama Anjum


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

* Re: [PATCH] wifi: mt76: connac: check for null before dereferencing
  2024-04-04 11:49   ` Muhammad Usama Anjum
@ 2024-04-04 11:51     ` Felix Fietkau
  0 siblings, 0 replies; 5+ messages in thread
From: Felix Fietkau @ 2024-04-04 11:51 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Lorenzo Bianconi, Ryder Lee, Shayne Chen,
	Sean Wang, Kalle Valo, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: kernel, kernel-janitors, linux-wireless, linux-kernel,
	linux-arm-kernel, linux-mediatek

On 04.04.24 13:49, Muhammad Usama Anjum wrote:
> Soft reminder

I have this one in my mt76 tree already, and it will be included in my 
next pull request to Kalle.

- Felix



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

end of thread, other threads:[~2024-04-04 11:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-01 14:44 [PATCH] wifi: mt76: connac: check for null before dereferencing Muhammad Usama Anjum
2024-03-04 10:17 ` AngeloGioacchino Del Regno
2024-03-11 17:11 ` Muhammad Usama Anjum
2024-04-04 11:49   ` Muhammad Usama Anjum
2024-04-04 11:51     ` Felix Fietkau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox