Skip to content

Commit 1474bc8

Browse files
committed
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>
1 parent fa8809a commit 1474bc8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

net/wireless/core.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,18 +238,24 @@ void cfg80211_register_wdev(struct cfg80211_registered_device *rdev,
238238
static inline void wdev_lock(struct wireless_dev *wdev)
239239
__acquires(wdev)
240240
{
241+
lockdep_assert_held(&wdev->wiphy->mtx);
241242
mutex_lock(&wdev->mtx);
242243
__acquire(wdev->mtx);
243244
}
244245

245246
static inline void wdev_unlock(struct wireless_dev *wdev)
246247
__releases(wdev)
247248
{
249+
lockdep_assert_held(&wdev->wiphy->mtx);
248250
__release(wdev->mtx);
249251
mutex_unlock(&wdev->mtx);
250252
}
251253

252-
#define ASSERT_WDEV_LOCK(wdev) lockdep_assert_held(&(wdev)->mtx)
254+
static inline void ASSERT_WDEV_LOCK(struct wireless_dev *wdev)
255+
{
256+
lockdep_assert_held(&wdev->wiphy->mtx);
257+
lockdep_assert_held(&wdev->mtx);
258+
}
253259

254260
static inline bool cfg80211_has_monitors_only(struct cfg80211_registered_device *rdev)
255261
{

0 commit comments

Comments
 (0)