public inbox for linux-mediatek@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2] wifi: mt76: mt7996: Fix null-ptr-deref in mt7996_mmio_wed_init()
@ 2025-04-07  3:23 Henry Martin
  2025-04-07  7:50 ` Markus Elfring
  2025-04-24  3:23 ` henry martin
  0 siblings, 2 replies; 4+ messages in thread
From: Henry Martin @ 2025-04-07  3:23 UTC (permalink / raw)
  To: nbd, lorenzo, ryder.lee, shayne.chen, sean.wang, matthias.bgg,
	angelogioacchino.delregno, chui-hao.chiu, bsdhenrymartin, rex.lu
  Cc: linux-wireless, linux-kernel, linux-arm-kernel, linux-mediatek

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@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



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

* Re: [PATCH v2] wifi: mt76: mt7996: Fix null-ptr-deref in mt7996_mmio_wed_init()
  2025-04-07  3:23 [PATCH v2] wifi: mt76: mt7996: Fix null-ptr-deref in mt7996_mmio_wed_init() Henry Martin
@ 2025-04-07  7:50 ` Markus Elfring
  2025-04-07  8:01   ` Johannes Berg
  2025-04-24  3:23 ` henry martin
  1 sibling, 1 reply; 4+ messages in thread
From: Markus Elfring @ 2025-04-07  7:50 UTC (permalink / raw)
  To: Henry Martin, linux-wireless, linux-mediatek, linux-arm-kernel
  Cc: LKML, Angelo Gioacchino Del Regno, Peter Chiu, Felix Fietkau,
	Lorenzo Bianconi, Matthias Brugger, Rex Lu, Ryder Lee, Sean Wang,
	Shayne Chen, Shengyu Qu

…
> Prevent null pointer dereference in mt7996_mmio_wed_init()

Would you occasionally like to mark the end of sentences with a dot?


Can any other summary phrase variant become more desirable accordingly?

Regards,
Markus


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

* Re: [PATCH v2] wifi: mt76: mt7996: Fix null-ptr-deref in mt7996_mmio_wed_init()
  2025-04-07  7:50 ` Markus Elfring
@ 2025-04-07  8:01   ` Johannes Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2025-04-07  8:01 UTC (permalink / raw)
  To: Markus Elfring, Henry Martin, linux-wireless, linux-mediatek,
	linux-arm-kernel
  Cc: LKML, Angelo Gioacchino Del Regno, Peter Chiu, Felix Fietkau,
	Lorenzo Bianconi, Matthias Brugger, Rex Lu, Ryder Lee, Sean Wang,
	Shayne Chen, Shengyu Qu

On Mon, 2025-04-07 at 09:50 +0200, Markus Elfring wrote:
> …
> > Prevent null pointer dereference in mt7996_mmio_wed_init()
> 
> Would you occasionally like to mark the end of sentences with a dot?
> 

They did one out of two times. Go away from the wireless list.

johannes


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

* Re: [PATCH v2] wifi: mt76: mt7996: Fix null-ptr-deref in mt7996_mmio_wed_init()
  2025-04-07  3:23 [PATCH v2] wifi: mt76: mt7996: Fix null-ptr-deref in mt7996_mmio_wed_init() Henry Martin
  2025-04-07  7:50 ` Markus Elfring
@ 2025-04-24  3:23 ` henry martin
  1 sibling, 0 replies; 4+ messages in thread
From: henry martin @ 2025-04-24  3:23 UTC (permalink / raw)
  To: nbd, lorenzo, ryder.lee, shayne.chen, sean.wang, matthias.bgg,
	angelogioacchino.delregno, chui-hao.chiu, bsdhenrymartin, rex.lu
  Cc: linux-wireless, linux-kernel, linux-arm-kernel, linux-mediatek

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@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@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
>


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

end of thread, other threads:[~2025-04-24  3:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07  3:23 [PATCH v2] wifi: mt76: mt7996: Fix null-ptr-deref in mt7996_mmio_wed_init() Henry Martin
2025-04-07  7:50 ` Markus Elfring
2025-04-07  8:01   ` Johannes Berg
2025-04-24  3:23 ` henry martin

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