On Tue, Nov 14, 2023 at 06:02:33PM +0100, Johannes Berg wrote: > On Tue, 2023-11-14 at 16:50 +0100, Johan Hovold wrote: > > Naively adding locking around the call in ieee80211_get_tx_power() > > (e.g. similar to 6b348f6e34ce ("wifi: mac80211: ethtool: always hold > > wiphy mutex")) does not work as there are other paths that call this > > function with the lock held, specifically via ieee80211_register_hw(). > > The latter we can just take the lock I guess? ieee80211_register_hw() is specifically already taking the lock. > > [ 7.127780] ieee80211_get_tx_power+0x19c/0x1c0 [mac80211] > > [ 7.127859] nl80211_send_iface+0x208/0x6a4 [cfg80211] > > [ 7.127946] nl80211_dump_interface+0x120/0x254 [cfg80211] > > And here maybe we should just take the mutex at the nl80211 level. Yeah, it looks like you can possibly add it to nl80211_dump_interface(). nl80211_send_iface() is already called in paths like: ieee80211_get_tx_power+0x28/0x1c0 [mac80211] nl80211_send_iface+0x208/0x6a4 [cfg80211] nl80211_notify_iface+0x58/0xcc [cfg80211] cfg80211_register_wdev+0xa0/0x12c [cfg80211] cfg80211_register_netdevice+0x7c/0x108 [cfg80211] ieee80211_if_add+0x4b0/0x5cc [mac80211] ieee80211_register_hw+0xbec/0xc2c [mac80211] > That's the nice thing now, it's shared between the layers :) > > I can't do it right now, but I'll take a look tomorrow. Sounds good, thanks. Johan