Skip to content

Commit 268f84a

Browse files
jmberg-intelgregkh
authored andcommitted
wifi: cfg80211: check wiphy mutex is held for wdev mutex
[ 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]>
1 parent f34056c commit 268f84a

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
@@ -228,18 +228,24 @@ void cfg80211_register_wdev(struct cfg80211_registered_device *rdev,
228228
static inline void wdev_lock(struct wireless_dev *wdev)
229229
__acquires(wdev)
230230
{
231+
lockdep_assert_held(&wdev->wiphy->mtx);
231232
mutex_lock(&wdev->mtx);
232233
__acquire(wdev->mtx);
233234
}
234235

235236
static inline void wdev_unlock(struct wireless_dev *wdev)
236237
__releases(wdev)
237238
{
239+
lockdep_assert_held(&wdev->wiphy->mtx);
238240
__release(wdev->mtx);
239241
mutex_unlock(&wdev->mtx);
240242
}
241243

242-
#define ASSERT_WDEV_LOCK(wdev) lockdep_assert_held(&(wdev)->mtx)
244+
static inline void ASSERT_WDEV_LOCK(struct wireless_dev *wdev)
245+
{
246+
lockdep_assert_held(&wdev->wiphy->mtx);
247+
lockdep_assert_held(&wdev->mtx);
248+
}
243249

244250
static inline bool cfg80211_has_monitors_only(struct cfg80211_registered_device *rdev)
245251
{

0 commit comments

Comments
 (0)