summaryrefslogtreecommitdiff
path: root/net/wireless/core.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2023-08-28 13:59:56 +0200
committerJohannes Berg <johannes.berg@intel.com>2023-09-11 11:27:21 +0200
commit1474bc87fe57deac726cc10203f73daa6c3212f7 (patch)
tree521b7cd2c60048a7347c111121aa503f68b83544 /net/wireless/core.h
parentfa8809a519d85f498f43fadaf82e10831f20625a (diff)
downloadlwn-1474bc87fe57deac726cc10203f73daa6c3212f7.tar.gz
lwn-1474bc87fe57deac726cc10203f73daa6c3212f7.zip
wifi: cfg80211: check wiphy mutex is held for wdev mutex
This might seem pretty pointless rather than changing the locking immediately, but it seems safer to run for a while with checks and the old locking scheme, and then remove the wdev lock later. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/core.h')
-rw-r--r--net/wireless/core.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/net/wireless/core.h b/net/wireless/core.h
index b9876b444e1b..5dc76ea3b84e 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -238,6 +238,7 @@ void cfg80211_register_wdev(struct cfg80211_registered_device *rdev,
static inline void wdev_lock(struct wireless_dev *wdev)
__acquires(wdev)
{
+ lockdep_assert_held(&wdev->wiphy->mtx);
mutex_lock(&wdev->mtx);
__acquire(wdev->mtx);
}
@@ -245,11 +246,16 @@ static inline void wdev_lock(struct wireless_dev *wdev)
static inline void wdev_unlock(struct wireless_dev *wdev)
__releases(wdev)
{
+ lockdep_assert_held(&wdev->wiphy->mtx);
__release(wdev->mtx);
mutex_unlock(&wdev->mtx);
}
-#define ASSERT_WDEV_LOCK(wdev) lockdep_assert_held(&(wdev)->mtx)
+static inline void ASSERT_WDEV_LOCK(struct wireless_dev *wdev)
+{
+ lockdep_assert_held(&wdev->wiphy->mtx);
+ lockdep_assert_held(&wdev->mtx);
+}
static inline bool cfg80211_has_monitors_only(struct cfg80211_registered_device *rdev)
{