Skip to contentSkip to conversation

wifi: cfg80211: stop PMSR before P2P and NAN teardown

PATCH New Zhao Li 1 participant 1 message Jul 31 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore

Zhao Li

author
#0 lore raw

PATCH 1/1 wifi: cfg80211: stop PMSR before P2P and NAN teardown

PMSR request teardown must abort active measurements while the wireless_dev is still present in the driver. cfg80211_leave_locked() and cfg80211_stop_pd() already do this before invoking the driver's stop callback, but cfg80211_stop_p2p_device() and cfg80211_stop_nan() do not.

Those helpers are also called directly by nl80211, rfkill shutdown, and wireless_dev unregister paths. If one of these paths stops a P2P device or NAN interface with a pending request, it removes the mac80211 subinterface from the driver first. Subsequent request cleanup cannot reach the lower driver's abort callback, but cfg80211 frees the request regardless. Driver state can then retain a stale request and use it when it later reports a result.

Call cfg80211_pmsr_wdev_down() before stopping the P2P device or NAN interface. This keeps lower-driver request state and cfg80211 request ownership in sync for all of the helpers' callers.

Fixes 9bb7e0f24e7e ("cfg80211: add peer measurement with FTM initiator API")
Assisted-by Codex:gpt-5.6-sol
---
 net/wireless/core.c | 3 +++
 1 file changed, 3 insertions(+)
net/wireless/core.c +3 -0
index 610238d723ff..d13310fef691 100644
@@ -237,6 +237,7 @@ void cfg80211_stop_p2p_device(struct cfg80211_registered_device *rdev,
 	if (!wdev_running(wdev))
 		return;
 
+	cfg80211_pmsr_wdev_down(wdev);
 	rdev_stop_p2p_device(rdev, wdev);
 	wdev->is_running = false;
 
@@ -264,6 +265,8 @@ void cfg80211_stop_nan(struct cfg80211_registered_device *rdev,
 	if (!wdev_running(wdev))
 		return;
 
+	cfg80211_pmsr_wdev_down(wdev);
+
 	/*
 	 * If there is a scheduled update pending, mark it as canceled, so the
 	 * empty schedule will be accepted

base-commit: 4a0bd262df757b25fc4e2a53c947317c119ced4e

Signature · 1 line
2.50.1 (Apple Git-155)