Skip to content

Commit 6fa3f59

Browse files
benzeaopsiff
authored andcommitted
wifi: mac80211: add/remove driver debugfs entries as appropriate
mainline inclusion from mainline-v6.7 category: bugfix When an interface is removed, we should also be deleting the driver debugfs entries (as it might still exist in DOWN state in mac80211). At the same time, when adding an interface, we can check the IEEE80211_SDATA_IN_DRIVER flag to know whether the interface was previously known to the driver and is simply being reconfigured. Fixes: a1f5dcb ("wifi: mac80211: add a driver callback to add vif debugfs") Signed-off-by: Benjamin Berg <[email protected]> Reviewed-by: Gregory Greenman <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://msgid.link/20231220043149.a9f64c359424.I7076526b5297ae8f832228079c999f7b8e147a4c@changeid Signed-off-by: Johannes Berg <[email protected]> (cherry picked from commit 0a3d898) Signed-off-by: Wentao Guan <[email protected]>
1 parent e465861 commit 6fa3f59

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

net/mac80211/debugfs_netdev.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -934,9 +934,12 @@ void ieee80211_debugfs_recreate_netdev(struct ieee80211_sub_if_data *sdata,
934934
{
935935
ieee80211_debugfs_remove_netdev(sdata);
936936
ieee80211_debugfs_add_netdev(sdata, mld_vif);
937-
drv_vif_add_debugfs(sdata->local, sdata);
938-
if (!mld_vif)
939-
ieee80211_link_debugfs_drv_add(&sdata->deflink);
937+
938+
if (sdata->flags & IEEE80211_SDATA_IN_DRIVER) {
939+
drv_vif_add_debugfs(sdata->local, sdata);
940+
if (!mld_vif)
941+
ieee80211_link_debugfs_drv_add(&sdata->deflink);
942+
}
940943
}
941944

942945
void ieee80211_link_debugfs_add(struct ieee80211_link_data *link)

net/mac80211/driver-ops.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ int drv_add_interface(struct ieee80211_local *local,
7272
if (ret)
7373
return ret;
7474

75-
sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
75+
if (!(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) {
76+
sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
7677

77-
if (!local->in_reconfig && !local->resuming) {
7878
drv_vif_add_debugfs(local, sdata);
7979
/* initially vif is not MLD */
8080
ieee80211_link_debugfs_drv_add(&sdata->deflink);
@@ -108,9 +108,13 @@ void drv_remove_interface(struct ieee80211_local *local,
108108
if (!check_sdata_in_driver(sdata))
109109
return;
110110

111+
sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER;
112+
113+
/* Remove driver debugfs entries */
114+
ieee80211_debugfs_recreate_netdev(sdata, sdata->vif.valid_links);
115+
111116
trace_drv_remove_interface(local, sdata);
112117
local->ops->remove_interface(&local->hw, &sdata->vif);
113-
sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER;
114118
trace_drv_return_void(local);
115119
}
116120

0 commit comments

Comments
 (0)