Create debugfs entry for the virtual monitor interface when it's created and delete them again when it's deleted again. Instead of creating them on deletion, when calling drv_remove_interface(). This fixes debugfs name collisions when deleting and re-creating a monitor interface with the same name. Signed-off-by: Alexander Wetzel <Alexander@xxxxxxxxxxxxxx> --- A user can still create collisions in the debugfs when using names like e.g. phy0-monitor for another monitor interface. And then trigger the creation of the virtual monitor interface... But I guess that's ok and not worth the hassle to fix it. --- net/mac80211/iface.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index b0c02942dac3..1a2b682c452c 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1162,6 +1162,7 @@ int ieee80211_add_virtual_monitor(struct ieee80211_local *local) } } + ieee80211_debugfs_recreate_netdev(sdata, false); set_bit(SDATA_STATE_RUNNING, &sdata->state); ret = ieee80211_check_queues(sdata, NL80211_IFTYPE_MONITOR); @@ -1212,6 +1213,7 @@ void ieee80211_del_virtual_monitor(struct ieee80211_local *local) return; } + clear_bit(SDATA_STATE_RUNNING, &sdata->state); RCU_INIT_POINTER(local->monitor_sdata, NULL); mutex_unlock(&local->iflist_mtx); @@ -1222,6 +1224,7 @@ void ieee80211_del_virtual_monitor(struct ieee80211_local *local) if (ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF)) drv_remove_interface(local, sdata); + ieee80211_debugfs_remove_netdev(sdata); kfree(sdata); } -- 2.48.1