On Mon, 2022-02-14 at 09:45 +0100, Arend van Spriel wrote: > > Correct. Just not sure I understand why is has to be RTNL lock. Well, does it? Now I forgot again from when I looked ;-) Surely for nl80211_get_reg_do() for example it has to be, at least today, though that is already protecting the regdom with RCU in the non- wiphy case, so doesn't really need to use RTNL. Similarly, nl80211_get_reg_dump() could use RCU. So that's easy, but all the interaction e.g. with brcms_reg_notifier() calling freq_reg_info() which uses it too, but then is called from wiphy_update_regulatory() from e.g. update_all_wiphy_regulatory() only with RTNL makes it all complicated ... > So would wiphy mutex be sufficient. I guess my question is what is > protected by these lock in wiphy_apply_custom_regulatory() and is it > really necessary to have both. See above. Honestly, I wouldn't mind if wiphy mutex (or RCU) _was_ sufficient. But we're not there, and the regulatory code is sufficiently complex and called sufficiently infrequently that I just haven't bothered trying to reduce its reliance on the RTNL. > Just some experimental coding where I ended up calling > wiphy_apply_custom_regulatory() upon IFF_UP and hit deadlock because > RTNL was already taken. Anyway, that code already ended up in the > garbage bin, but wanted to ask anyway. Learning by asking (stupid) > questions ;-) > Given the length and depth I had to go to to answer it, that really couldn't be a stupid question :) johannes