diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 68596ef78b15..b9961edf6fa5 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c @@ -1019,8 +1019,10 @@ void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata) if (!sdata->vif.debugfs_dir) return; - debugfs_remove_recursive(sdata->vif.debugfs_dir); + struct dentry *debugfs_dir = sdata->vif.debugfs_dir; + sdata->vif.debugfs_dir = NULL; + debugfs_remove_recursive(debugfs_dir); sdata->debugfs.subdir_stations = NULL; } diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c index 1e9389c49a57..357f310ec75f 100644 --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c @@ -1284,6 +1284,11 @@ void ieee80211_sta_debugfs_add(struct sta_info *sta) void ieee80211_sta_debugfs_remove(struct sta_info *sta) { + struct ieee80211_sub_if_data *sdata = sta->sdata; + + if (!sdata->vif.debugfs_dir) + return; + debugfs_remove_recursive(sta->debugfs_dir); sta->debugfs_dir = NULL; }