linux/net/wireless
Zhao Li 0451392295 wifi: cfg80211: publish PMSR request before starting the driver
nl80211_pmsr_start() assigns the request cookie, calls the driver's
->start_pmsr() callback, and only then adds the request to
wdev->pmsr_list, without holding pmsr_lock for the addition.

mac80211_hwsim saves the request in its start callback and returns. Since
nl80211 uses parallel_ops, an immediate REPORT_PMSR can then run before
nl80211_pmsr_start() reaches its post-start list_add_tail(). hwsim also
dispatches reports from its virtio receive workqueue. Completion removes
the request from wdev->pmsr_list under pmsr_lock and frees it.

Thus completion can precede publication, race the unlocked list mutation,
or free the request before nl80211_pmsr_start() reads req->cookie for the
netlink reply.

Add the request to wdev->pmsr_list under pmsr_lock before calling the
driver, and use a cookie value saved before the call so the request is not
dereferenced after a successful start. On an error return the driver has
not retained or completed the request, so remove it from the list under the
lock and free it.

Fixes: 9bb7e0f24e ("cfg80211: add peer measurement with FTM initiator API")
Link: https://lore.kernel.org/all/20260723010916.76433-1-enderaoelyther@gmail.com/
Assisted-by: Codex:gpt-5
Assisted-by: Claude:opus-4.8
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20260723202223.99661-1-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-07-28 15:08:57 +02:00
..
certs wifi: cfg80211: fix certs build to not depend on file order 2023-12-14 09:11:51 +01:00
tests wifi: cfg80211: add a function to parse UHR DBE 2026-05-20 12:03:19 +02:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
ap.c wifi: cfg80211: remove wdev mutex 2023-09-11 11:27:23 +02:00
chan.c wifi: cfg80211: remove 5/10 MHz channel support 2026-06-03 14:07:05 +02:00
core.c wifi: cfg80211: use wiphy work for socket owner autodisconnect 2026-07-07 09:27:42 +02:00
core.h wifi: cfg80211: use wiphy work for socket owner autodisconnect 2026-07-07 09:27:42 +02:00
debugfs.c wifi: cfg80211: Add parameters to radio-specific debugfs directories 2025-10-27 09:18:41 +01:00
debugfs.h
ethtool.c wifi: cfg80211: Remove the redundant wiphy_dev 2025-09-10 15:05:48 +02:00
ibss.c wifi: cfg80211: support key installation on non-netdev wdevs 2026-03-02 11:28:33 +01:00
Kconfig wifi: cfg80211: stop exporting wext symbols 2024-10-08 21:53:31 +02:00
Makefile wifi: mac80211, cfg80211: Export michael_mic() and move it to cfg80211 2026-04-08 08:55:15 +02:00
mesh.c wifi: cfg80211: move DFS related members to links[] in wireless_dev 2024-09-06 13:01:05 +02:00
michael-mic.c wifi: cfg80211: Explicitly include <linux/export.h> in michael-mic.c 2026-04-09 08:54:43 +02:00
mlme.c wifi: cfg80211: validate assoc response length before status and IE access 2026-07-07 09:31:38 +02:00
nl80211.c wifi: cfg80211: use wiphy work for socket owner autodisconnect 2026-07-07 09:27:42 +02:00
nl80211.h wifi: cfg80211: allow representing NPCA in chandef 2026-05-05 14:49:02 +02:00
ocb.c wifi: cfg80211: remove wdev mutex 2023-09-11 11:27:23 +02:00
of.c wifi: Add SPDX ids to some files in the wireless subsystem 2026-03-06 10:54:23 +01:00
pmsr.c wifi: cfg80211: publish PMSR request before starting the driver 2026-07-28 15:08:57 +02:00
radiotap.c wifi: Add SPDX ids to some files in the wireless subsystem 2026-03-06 10:54:23 +01:00
rdev-ops.h wifi: cfg80211: add start/stop proximity detection commands 2026-05-05 13:36:30 +02:00
reg.c wifi: cfg80211/mac80211: Add NL80211_IFTYPE_PD for PD PASN and PMSR operations 2026-05-05 13:28:57 +02:00
reg.h wifi: Add SPDX ids to some files in the wireless subsystem 2026-03-06 10:54:23 +01:00
scan.c wifi: cfg80211: bound element ID read when checking non-inheritance 2026-07-07 14:00:35 +02:00
sme.c wifi: cfg80211: use wiphy work for socket owner autodisconnect 2026-07-07 09:27:42 +02:00
sysfs.c Networking changes for 7.1. 2026-04-14 18:36:10 -07:00
sysfs.h
trace.c wifi: Add SPDX ids to some files in the wireless subsystem 2026-03-06 10:54:23 +01:00
trace.h wifi: cfg80211: allow representing NPCA in chandef 2026-05-05 14:49:02 +02:00
util.c wifi: cfg80211: remove 5/10 MHz channel support 2026-06-03 14:07:05 +02:00
wext-compat.c wifi: cfg80211: use strscpy in cfg80211_wext_giwname 2026-05-28 09:50:42 +02:00
wext-compat.h Revert "wifi: cfg80211: unexport wireless_nlevent_flush()" 2024-10-09 08:53:01 +02:00
wext-core.c wifi: Add SPDX ids to some files in the wireless subsystem 2026-03-06 10:54:23 +01:00
wext-priv.c wifi: Add SPDX ids to some files in the wireless subsystem 2026-03-06 10:54:23 +01:00
wext-proc.c wifi: Add SPDX ids to some files in the wireless subsystem 2026-03-06 10:54:23 +01:00
wext-sme.c wifi: cfg80211: validate IEs in cfg80211_wext_siwgenie() 2026-07-28 15:07:18 +02:00