On Fri, 2023-08-11 at 09:30 +0200, Max Schulze wrote: > In cfg80211_cqm_rssi_notify, when calling cfg80211_cqm_rssi_update, this might free > the wdev->cqm_config . Check for this when it returns. That doesn't seem right? How does cfg80211_cqm_rssi_update() free it? > This has been observed on brcmfmac, when a RSSI event is generated just right > after disconnecting from AP. Then probing for STA details returns nothing, as > evidenced i.e. by > "ieee80211 phy0: brcmf_cfg80211_get_station: GET STA INFO failed, -52". I think the issue then isn't that this frees it but rather than a free of it races with the reporting? > --- a/net/wireless/nl80211.c > +++ b/net/wireless/nl80211.c > @@ -19088,7 +19088,7 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev, > > cfg80211_cqm_rssi_update(rdev, dev); > > - if (rssi_level == 0) > + if (rssi_level == 0 && wdev->cqm_config) > rssi_level = wdev->cqm_config->last_rssi_event_value; > But if it's a race, then this isn't actually going to really fix the issue, rather it just makes it (much) less likely. Since we can probably neither lock the wdev here nor require calls to this function with wdev lock held, it looks like we need to protect the pointer with RCU instead? johannes