Re: [PATCH 5.10 199/491] wifi: cfg80211: cancel pmsr_free_wk in cfg80211_pmsr_wdev_down

Ben Hutchings
2026-04-15T12:43:01Z

[-- Attachment #1: Type: text/plain, Size: 2613 bytes --]

On Mon, 2026-04-13 at 17:57 +0200, Greg Kroah-Hartman wrote:
> 5.10-stable review patch. If anyone has any objections, please let me know.
>
> ------------------
>
> From: Peddolla Harshavardhan Reddy <peddolla.reddy@oss.qualcomm.com>
>
> [ Upstream commit 6dccbc9f3e1d38565dff7730d2b7d1e8b16c9b09 ]
>
> When the nl80211 socket that originated a PMSR request is
> closed, cfg80211_release_pmsr() sets the request's nl_portid
> to zero and schedules pmsr_free_wk to process the abort
> asynchronously. If the interface is concurrently torn down
> before that work runs, cfg80211_pmsr_wdev_down() calls
> cfg80211_pmsr_process_abort() directly. However, the already-
> scheduled pmsr_free_wk work item remains pending and may run
> after the interface has been removed from the driver. This
> could cause the driver's abort_pmsr callback to operate on a
> torn-down interface, leading to undefined behavior and
> potential crashes.
>
> Cancel pmsr_free_wk synchronously in cfg80211_pmsr_wdev_down()
> before calling cfg80211_pmsr_process_abort(). This ensures any
> pending or in-progress work is drained before interface teardown
> proceeds, preventing the work from invoking the driver abort
> callback after the interface is gone.

But cfg80211_pmsr_wdev_down() holds the wiphy lock which the work item
also tries to acquire. Cancelling it synchronously can then lead to
deadlock.

I don't know whether this is also a problem upstream, as locking in
cfg80211 has changed significantly since 5.10.

Ben.

> Fixes: 9bb7e0f24e7e ("cfg80211: add peer measurement with FTM initiator API")
> Signed-off-by: Peddolla Harshavardhan Reddy <peddolla.reddy@oss.qualcomm.com>
> Link: https://patch.msgid.link/20260305160712.1263829-3-peddolla.reddy@oss.qualcomm.com
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> net/wireless/pmsr.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/wireless/pmsr.c b/net/wireless/pmsr.c
> index 7503c7dd71ab5..32cea07b98fd1 100644
> --- a/net/wireless/pmsr.c
> +++ b/net/wireless/pmsr.c
> @@ -620,6 +620,7 @@ void cfg80211_pmsr_wdev_down(struct wireless_dev *wdev)
> }
> spin_unlock_bh(&wdev->pmsr_lock);
>
> + cancel_work_sync(&wdev->pmsr_free_wk);
> if (found)
> cfg80211_pmsr_process_abort(wdev);
>

--
Ben Hutchings
The obvious mathematical breakthrough [to break modern encryption]
would be development of an easy way to factor large prime numbers.
- Bill Gates

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]