[PATCH v2] wifi: mt76: mt7996: Fix null-ptr-deref in mt7996_mmio_wed_init()
henry martin
bsdhenrymartin at gmail.com
Wed Apr 23 20:23:39 PDT 2025
Hi all,
I’d like to kindly follow up on my previous patch submission to check if there
are any additional feedback or suggestions for improvement. If there are
further changes needed, I’ll be happy to address them and send a v3.
Please let me know if you have any comments. Thanks for your time and review!
Best regards,
Henry Martin <bsdhenrymartin at gmail.com> 于2025年4月7日周一 11:24写道:
>
> devm_ioremap() returns NULL on error. Currently, mt7996_mmio_wed_init()
> does not check for this case, which results in a NULL pointer
> dereference.
>
> Prevent null pointer dereference in mt7996_mmio_wed_init()
>
> Fixes: 83eafc9251d6 ("wifi: mt76: mt7996: add wed tx support")
> Signed-off-by: Henry Martin <bsdhenrymartin at gmail.com>
> ---
> V1 -> V2: Add a blank after the check and correct the summary.
>
> drivers/net/wireless/mediatek/mt76/mt7996/mmio.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c b/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c
> index 13b188e281bd..af9169030bad 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c
> @@ -323,6 +323,9 @@ int mt7996_mmio_wed_init(struct mt7996_dev *dev, void *pdev_ptr,
> wed->wlan.base = devm_ioremap(dev->mt76.dev,
> pci_resource_start(pci_dev, 0),
> pci_resource_len(pci_dev, 0));
> + if (!wed->wlan.base)
> + return -ENOMEM;
> +
> wed->wlan.phy_base = pci_resource_start(pci_dev, 0);
>
> if (hif2) {
> --
> 2.34.1
>
More information about the Linux-mediatek
mailing list