On Mon, May 26, 2025 at 05:19:03PM +0800, Wentao Liang wrote: > The function ieee80211_chsw_switch_vifs() calls the function > ieee80211_link_get_chanctx(), but does not check its return value. > The return value is a null pointer if the ieee80211_link_get_chanctx() > fails. This will lead to a null pointer dereference in the following > code "&old_ctx->conf". A proper implementation can be found in > ieee80211_link_use_reserved_assign(). > > Add a null pointer check and goto error handling path if the > function fails. > > Fixes: 5d52ee811019 ("mac80211: allow reservation of a running chanctx") > Cc: stable@xxxxxxxxxxxxxxx # v3.16 > Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx> > --- > v2: Fix code error. > > net/mac80211/chan.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c > index a442cb667520..c9b703c283e7 100644 > --- a/net/mac80211/chan.c > +++ b/net/mac80211/chan.c > @@ -1503,6 +1503,10 @@ static int ieee80211_chsw_switch_vifs(struct ieee80211_local *local, > continue; > > old_ctx = ieee80211_link_get_chanctx(link); > + if (WARN_ON(!old_ctx)) { You just caused the machine to crash and reboot on billions of Linux systems if this ever is triggered. So please never do that :( thanks, greg k-h