diff mbox series

[v2] wifi: mt76: mt7996: Fix null-ptr-deref in mt7996_mmio_wed_init()

Message ID 20250407032349.83360-1-bsdhenrymartin@gmail.com (mailing list archive)
State New
Delegated to: Felix Fietkau
Headers show
Series [v2] wifi: mt76: mt7996: Fix null-ptr-deref in mt7996_mmio_wed_init() | expand

Checks

Context Check Description
wifibot/fixes_present success Fixes tag not required for -next series
wifibot/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
wifibot/tree_selection success Guessed tree name to be wireless-next
wifibot/ynl success Generated files up to date; no warnings/errors; no diff in generated;
wifibot/build_32bit success Errors and warnings before: 0 this patch: 0
wifibot/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
wifibot/build_clang success Errors and warnings before: 0 this patch: 0
wifibot/build_clang_rust success No Rust files in patch. Skipping build
wifibot/build_tools success No tools touched, skip
wifibot/check_selftest success No net selftest shell script
wifibot/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
wifibot/deprecated_api success None detected
wifibot/header_inline success No static functions without inline keyword in header files
wifibot/kdoc success Errors and warnings before: 0 this patch: 0
wifibot/source_inline success Was 0 now: 0
wifibot/verify_fixes success Fixes tag looks correct
wifibot/verify_signedoff success Signed-off-by tag matches author and committer

Commit Message

henry martin April 7, 2025, 3:23 a.m. UTC
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(+)

Comments

Markus Elfring April 7, 2025, 7:50 a.m. UTC | #1
> 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
Johannes Berg April 7, 2025, 8:01 a.m. UTC | #2
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
diff mbox series

Patch

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) {