On 11/21/2024 2:11 PM, Johannes Berg wrote: > From: Johannes Berg <johannes.berg@xxxxxxxxx> > > Define a guard for the wiphy mutex, and use it in > most code in cfg80211, though not all due to some > interaction with RTNL and/or indentation. > > Suggested-by: Jeff Johnson <quic_jjohnson@xxxxxxxxxxx> > Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx> > --- > include/net/cfg80211.h | 4 + > net/wireless/chan.c | 4 +- > net/wireless/core.c | 53 +++---- > net/wireless/mlme.c | 8 +- > net/wireless/nl80211.c | 195 +++++++++-------------- > net/wireless/pmsr.c | 4 +- > net/wireless/reg.c | 49 +++--- > net/wireless/scan.c | 40 +++-- > net/wireless/sme.c | 12 +- > net/wireless/util.c | 7 +- > net/wireless/wext-compat.c | 316 +++++++++++++------------------------ > net/wireless/wext-sme.c | 43 ++--- > 12 files changed, 284 insertions(+), 451 deletions(-) > ... > @@ -1007,10 +1003,10 @@ int wiphy_register(struct wiphy *wiphy) > rdev->wiphy.features |= NL80211_FEATURE_SCAN_FLUSH; > > rtnl_lock(); > - wiphy_lock(&rdev->wiphy); > - res = device_add(&rdev->wiphy.dev); > + scoped_guard(wiphy, &rdev->wiphy); { bad semicolon? > + res = device_add(&rdev->wiphy.dev); > + } > if (res) { > - wiphy_unlock(&rdev->wiphy); > rtnl_unlock(); > return res; > } the rest LGTM, thanks for the guard Reviewed-by: Jeff Johnson <quic_jjohnson@xxxxxxxxxxx>