]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
wifi: cfg80211: cancel wiphy_work before freeing wiphy
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Thu, 6 Mar 2025 10:37:59 +0000 (12:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Mar 2025 19:54:10 +0000 (12:54 -0700)
commita5158d67bff06cb6fea31be39aeb319fd908ed8e
treed05e7015944eb4b3e1f70c3e5c5f76aec262a59d
parent83a73cb88f1d56d69f8bec9180fea7e4da26f955
wifi: cfg80211: cancel wiphy_work before freeing wiphy

[ Upstream commit 72d520476a2fab6f3489e8388ab524985d6c4b90 ]

A wiphy_work can be queued from the moment the wiphy is allocated and
initialized (i.e. wiphy_new_nm). When a wiphy_work is queued, the
rdev::wiphy_work is getting queued.

If wiphy_free is called before the rdev::wiphy_work had a chance to run,
the wiphy memory will be freed, and then when it eventally gets to run
it'll use invalid memory.

Fix this by canceling the work before freeing the wiphy.

Fixes: a3ee4dc84c4e ("wifi: cfg80211: add a work abstraction with special semantics")
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20250306123626.efd1d19f6e07.I48229f96f4067ef73f5b87302335e2fd750136c9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/wireless/core.c