wifi: mac80211: mlme: fix null-ptr deref on failed assoc
authorJohannes Berg <johannes.berg@intel.com>
Wed, 21 Sep 2022 00:44:58 +0000 (02:44 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 7 Oct 2022 13:24:16 +0000 (15:24 +0200)
commit78a6a43aaf87180ec7425a2a90468e1b4d09a1ec
tree68b4db19f80072457ebfe34809346b8f4a6029c1
parent1177aaa7fe9373c762cd5bf5f5de8517bac989d5
wifi: mac80211: mlme: fix null-ptr deref on failed assoc

If association to an AP without a link 0 fails, then we crash in
tracing because it assumes that either ap_mld_addr or link 0 BSS
is valid, since we clear sdata->vif.valid_links and then don't
add the ap_mld_addr to the struct.

Since we clear also sdata->vif.cfg.ap_addr, keep a local copy of
it and assign it earlier, before clearing valid_links, to fix
this.

Fixes: 81151ce462e5 ("wifi: mac80211: support MLO authentication/association with one link")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/mlme.c