HomeFreeBSD

net80211: fix a race between ieee80211_sta_join and scan entries

Description

net80211: fix a race between ieee80211_sta_join and scan entries

We were seeing panics during ieee80211_sta_join() which seemed that
the ni->ni_chan was not valid anymore, which was true.
We also saw errors indicating data put into ni_ies became inalid.

The problem was that the ieee80211_scan_entry passed into
ieee80211_sta_join() (in the observed case from setmlme_assoc_sta())
became invalid during ieee80211_alloc_node().
As a result for the ni_chan case the the rateset and len in rates[1]
became invalid. Similarly for the IEs.

Make a (deep)copy of the scan entry in setmlme_assoc_sta() and return
the copy as once we leave ieee80211_scan_iterate() we can no longer
rely on the scan entry to be valid.

Sponsored by: The FreeBSD Foundation
Reported by: rm, ziaee, bz
Tested by: rm, ziaee, bz
PR: 286063
Reviewed by: adrian (,emaste)
Differential Revision: https://reviews.freebsd.org/D49865

(cherry picked from commit aff56b4f0b25c44c9c2cae9a3f816c4277057a71)

Details

Provenance
bzAuthored on Apr 16 2025, 7:10 PM
Reviewer
adrian
Differential Revision
D49865: net80211: fix a race between ieee80211_sta_join and scan entries
Parents
rG707cfc54f8f3: LinuxKPI: add is_unicast_ether_addr()
Branches
Unknown
Tags
Unknown