Skip to content
Snippets Groups Projects
Commit 268f84a8 authored by Johannes Berg's avatar Johannes Berg Committed by Greg Kroah-Hartman
Browse files

wifi: cfg80211: check wiphy mutex is held for wdev mutex


[ Upstream commit 1474bc87fe57deac726cc10203f73daa6c3212f7 ]

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: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent f34056c3
No related branches found
No related tags found
No related merge requests found
...@@ -228,6 +228,7 @@ void cfg80211_register_wdev(struct cfg80211_registered_device *rdev, ...@@ -228,6 +228,7 @@ void cfg80211_register_wdev(struct cfg80211_registered_device *rdev,
static inline void wdev_lock(struct wireless_dev *wdev) static inline void wdev_lock(struct wireless_dev *wdev)
__acquires(wdev) __acquires(wdev)
{ {
lockdep_assert_held(&wdev->wiphy->mtx);
mutex_lock(&wdev->mtx); mutex_lock(&wdev->mtx);
__acquire(wdev->mtx); __acquire(wdev->mtx);
} }
...@@ -235,11 +236,16 @@ static inline void wdev_lock(struct wireless_dev *wdev) ...@@ -235,11 +236,16 @@ static inline void wdev_lock(struct wireless_dev *wdev)
static inline void wdev_unlock(struct wireless_dev *wdev) static inline void wdev_unlock(struct wireless_dev *wdev)
__releases(wdev) __releases(wdev)
{ {
lockdep_assert_held(&wdev->wiphy->mtx);
__release(wdev->mtx); __release(wdev->mtx);
mutex_unlock(&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) static inline bool cfg80211_has_monitors_only(struct cfg80211_registered_device *rdev)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment