public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wifi: mac80211: fix NULL pointer dereference in ieee80211_mesh_build_beacon()
@ 2026-01-19 15:00 Jeongjun Park
  2026-01-20  8:12 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Jeongjun Park @ 2026-01-19 15:00 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-wireless, syzbot+81cd9dc1596563141d19, linux-kernel,
	Jeongjun Park

NULL pointer dereference bug occurs because ieee80211_mesh_build_beacon()
does not check the return value of ieee80211_get_sband().

Therefore, we need to add a return value check to prevent this.

Reported-by: syzbot+81cd9dc1596563141d19@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/696e34bf.a70a0220.34546f.04ad.GAE@google.com/
Fixes: 147ceae20534 ("wifi: mac80211: simplify adding supported rates")
Signed-off-by: Jeongjun Park <aha310510@gmail.com>
---
 net/mac80211/mesh.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 68901f1def0d..eb3a346226bd 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -964,6 +964,8 @@ ieee80211_mesh_build_beacon(struct ieee80211_if_mesh *ifmsh)
 	sdata = container_of(ifmsh, struct ieee80211_sub_if_data, u.mesh);
 
 	sband = ieee80211_get_sband(sdata);
+	if (!sband)
+		return -EINVAL;
 
 	ie_len_he_cap = ieee80211_ie_len_he_cap(sdata);
 	ie_len_eht_cap = ieee80211_ie_len_eht_cap(sdata);
--

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

* Re: [PATCH] wifi: mac80211: fix NULL pointer dereference in ieee80211_mesh_build_beacon()
  2026-01-19 15:00 [PATCH] wifi: mac80211: fix NULL pointer dereference in ieee80211_mesh_build_beacon() Jeongjun Park
@ 2026-01-20  8:12 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2026-01-20  8:12 UTC (permalink / raw)
  To: Jeongjun Park; +Cc: linux-wireless, syzbot+81cd9dc1596563141d19, linux-kernel

On Tue, 2026-01-20 at 00:00 +0900, Jeongjun Park wrote:
> NULL pointer dereference bug occurs because ieee80211_mesh_build_beacon()
> does not check the return value of ieee80211_get_sband().
> 
> Therefore, we need to add a return value check to prevent this.

No we don't, please try to understand the code, and why it can even get
here when the mesh interface isn't operating.

johannes

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

end of thread, other threads:[~2026-01-20  8:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-19 15:00 [PATCH] wifi: mac80211: fix NULL pointer dereference in ieee80211_mesh_build_beacon() Jeongjun Park
2026-01-20  8:12 ` Johannes Berg

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