Skip to content

Commit

Permalink
wifi: cfg80211: check wiphy mutex is held for wdev mutex
Browse files Browse the repository at this point in the history
[ Upstream commit 1474bc8 ]

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 <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
jmberg-intel authored and gregkh committed Aug 29, 2024
1 parent 17e61f8 commit 19d13ec
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion net/wireless/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,18 +228,24 @@ 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);
}

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)
{
Expand Down

0 comments on commit 19d13ec

Please sign in to comment.