* [PATCH] wifi: mt76: mt7925: fix get wrong chip cap from incorrect pointer
@ 2024-11-01 8:12 Mingyen Hsieh
2024-11-04 0:36 ` Ping-Ke Shih
0 siblings, 1 reply; 2+ messages in thread
From: Mingyen Hsieh @ 2024-11-01 8:12 UTC (permalink / raw)
To: nbd, lorenzo
Cc: deren.wu, Sean.Wang, Soul.Huang, Leon.Yen, Michael.Lo,
Eric-SY.Chang, km.lin, robin.chiu, ch.yeh, posh.sun, Quan.Zhou,
Ryder.Lee, Shayne.Chen, linux-wireless, linux-mediatek,
Ming Yen Hsieh
From: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Use tlv instead of skb, because using skb will get invalid data
with wrong offset.
Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index 0c2a2337c313..9b6aff463063 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -823,7 +823,7 @@ mt7925_mcu_get_nic_capability(struct mt792x_dev *dev)
mt7925_mcu_parse_phy_cap(dev, tlv->data);
break;
case MT_NIC_CAP_CHIP_CAP:
- memcpy(&dev->phy.chip_cap, (void *)skb->data, sizeof(u64));
+ memcpy(&dev->phy.chip_cap, (void *)tlv->data, sizeof(u64));
break;
case MT_NIC_CAP_EML_CAP:
mt7925_mcu_parse_eml_cap(dev, tlv->data);
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] wifi: mt76: mt7925: fix get wrong chip cap from incorrect pointer
2024-11-01 8:12 [PATCH] wifi: mt76: mt7925: fix get wrong chip cap from incorrect pointer Mingyen Hsieh
@ 2024-11-04 0:36 ` Ping-Ke Shih
0 siblings, 0 replies; 2+ messages in thread
From: Ping-Ke Shih @ 2024-11-04 0:36 UTC (permalink / raw)
To: Mingyen Hsieh, nbd@nbd.name, lorenzo@kernel.org
Cc: deren.wu@mediatek.com, Sean.Wang@mediatek.com,
Soul.Huang@mediatek.com, Leon.Yen@mediatek.com,
Michael.Lo@mediatek.com, Eric-SY.Chang@mediatek.com,
km.lin@mediatek.com, robin.chiu@mediatek.com, ch.yeh@mediatek.com,
posh.sun@mediatek.com, Quan.Zhou@mediatek.com,
Ryder.Lee@mediatek.com, Shayne.Chen@mediatek.com,
linux-wireless@vger.kernel.org,
linux-mediatek@lists.infradead.org
Mingyen Hsieh <mingyen.hsieh@mediatek.com> wrote:
>
> Use tlv instead of skb, because using skb will get invalid data
> with wrong offset.
>
> Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
> ---
> drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
> b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
> index 0c2a2337c313..9b6aff463063 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
> @@ -823,7 +823,7 @@ mt7925_mcu_get_nic_capability(struct mt792x_dev *dev)
> mt7925_mcu_parse_phy_cap(dev, tlv->data);
> break;
> case MT_NIC_CAP_CHIP_CAP:
> - memcpy(&dev->phy.chip_cap, (void *)skb->data, sizeof(u64));
> + memcpy(&dev->phy.chip_cap, (void *)tlv->data, sizeof(u64));
chip_cap is u64 in CPU order, and tlv->data coming from firmware should be
little-endian order. So using le64_to_cpu() might be more suitable:
dev->phy.chip_cap = le64_to_cpu((__le64 *)tlv->data);
> break;
> case MT_NIC_CAP_EML_CAP:
> mt7925_mcu_parse_eml_cap(dev, tlv->data);
> --
> 2.45.2
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-04 0:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-01 8:12 [PATCH] wifi: mt76: mt7925: fix get wrong chip cap from incorrect pointer Mingyen Hsieh
2024-11-04 0:36 ` Ping-Ke Shih
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).