Commit 93015f0f authored by Jouni Malinen's avatar Jouni Malinen Committed by John W. Linville

mac80211: Fix debugfs file add/del for netdev

Previous version was using incorrect union structures for non-AP
interfaces when adding and removing max_ratectrl_rateidx and
force_unicast_rateidx entries. Depending on the vif type, this ended
up in corrupting debugfs entries since the dentries inside different
union structures ended up going being on top of eachother.. As the
end result, debugfs files were being left behind with references to
freed data (instant kernel oops on access) and directories were not
removed properly when unloading mac80211 drivers. This patch fixes
those issues by using only a single union structure based on the vif
type.
Signed-off-by: default avatarJouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 667d8af9
...@@ -248,8 +248,8 @@ IEEE80211_IF_WFILE(min_discovery_timeout, ...@@ -248,8 +248,8 @@ IEEE80211_IF_WFILE(min_discovery_timeout,
static void add_sta_files(struct ieee80211_sub_if_data *sdata) static void add_sta_files(struct ieee80211_sub_if_data *sdata)
{ {
DEBUGFS_ADD(drop_unencrypted, sta); DEBUGFS_ADD(drop_unencrypted, sta);
DEBUGFS_ADD(force_unicast_rateidx, ap); DEBUGFS_ADD(force_unicast_rateidx, sta);
DEBUGFS_ADD(max_ratectrl_rateidx, ap); DEBUGFS_ADD(max_ratectrl_rateidx, sta);
DEBUGFS_ADD(state, sta); DEBUGFS_ADD(state, sta);
DEBUGFS_ADD(bssid, sta); DEBUGFS_ADD(bssid, sta);
...@@ -283,8 +283,8 @@ static void add_ap_files(struct ieee80211_sub_if_data *sdata) ...@@ -283,8 +283,8 @@ static void add_ap_files(struct ieee80211_sub_if_data *sdata)
static void add_wds_files(struct ieee80211_sub_if_data *sdata) static void add_wds_files(struct ieee80211_sub_if_data *sdata)
{ {
DEBUGFS_ADD(drop_unencrypted, wds); DEBUGFS_ADD(drop_unencrypted, wds);
DEBUGFS_ADD(force_unicast_rateidx, ap); DEBUGFS_ADD(force_unicast_rateidx, wds);
DEBUGFS_ADD(max_ratectrl_rateidx, ap); DEBUGFS_ADD(max_ratectrl_rateidx, wds);
DEBUGFS_ADD(peer, wds); DEBUGFS_ADD(peer, wds);
} }
...@@ -292,8 +292,8 @@ static void add_wds_files(struct ieee80211_sub_if_data *sdata) ...@@ -292,8 +292,8 @@ static void add_wds_files(struct ieee80211_sub_if_data *sdata)
static void add_vlan_files(struct ieee80211_sub_if_data *sdata) static void add_vlan_files(struct ieee80211_sub_if_data *sdata)
{ {
DEBUGFS_ADD(drop_unencrypted, vlan); DEBUGFS_ADD(drop_unencrypted, vlan);
DEBUGFS_ADD(force_unicast_rateidx, ap); DEBUGFS_ADD(force_unicast_rateidx, vlan);
DEBUGFS_ADD(max_ratectrl_rateidx, ap); DEBUGFS_ADD(max_ratectrl_rateidx, vlan);
} }
static void add_monitor_files(struct ieee80211_sub_if_data *sdata) static void add_monitor_files(struct ieee80211_sub_if_data *sdata)
...@@ -381,8 +381,8 @@ static void add_files(struct ieee80211_sub_if_data *sdata) ...@@ -381,8 +381,8 @@ static void add_files(struct ieee80211_sub_if_data *sdata)
static void del_sta_files(struct ieee80211_sub_if_data *sdata) static void del_sta_files(struct ieee80211_sub_if_data *sdata)
{ {
DEBUGFS_DEL(drop_unencrypted, sta); DEBUGFS_DEL(drop_unencrypted, sta);
DEBUGFS_DEL(force_unicast_rateidx, ap); DEBUGFS_DEL(force_unicast_rateidx, sta);
DEBUGFS_DEL(max_ratectrl_rateidx, ap); DEBUGFS_DEL(max_ratectrl_rateidx, sta);
DEBUGFS_DEL(state, sta); DEBUGFS_DEL(state, sta);
DEBUGFS_DEL(bssid, sta); DEBUGFS_DEL(bssid, sta);
...@@ -416,8 +416,8 @@ static void del_ap_files(struct ieee80211_sub_if_data *sdata) ...@@ -416,8 +416,8 @@ static void del_ap_files(struct ieee80211_sub_if_data *sdata)
static void del_wds_files(struct ieee80211_sub_if_data *sdata) static void del_wds_files(struct ieee80211_sub_if_data *sdata)
{ {
DEBUGFS_DEL(drop_unencrypted, wds); DEBUGFS_DEL(drop_unencrypted, wds);
DEBUGFS_DEL(force_unicast_rateidx, ap); DEBUGFS_DEL(force_unicast_rateidx, wds);
DEBUGFS_DEL(max_ratectrl_rateidx, ap); DEBUGFS_DEL(max_ratectrl_rateidx, wds);
DEBUGFS_DEL(peer, wds); DEBUGFS_DEL(peer, wds);
} }
...@@ -425,8 +425,8 @@ static void del_wds_files(struct ieee80211_sub_if_data *sdata) ...@@ -425,8 +425,8 @@ static void del_wds_files(struct ieee80211_sub_if_data *sdata)
static void del_vlan_files(struct ieee80211_sub_if_data *sdata) static void del_vlan_files(struct ieee80211_sub_if_data *sdata)
{ {
DEBUGFS_DEL(drop_unencrypted, vlan); DEBUGFS_DEL(drop_unencrypted, vlan);
DEBUGFS_DEL(force_unicast_rateidx, ap); DEBUGFS_DEL(force_unicast_rateidx, vlan);
DEBUGFS_DEL(max_ratectrl_rateidx, ap); DEBUGFS_DEL(max_ratectrl_rateidx, vlan);
} }
static void del_monitor_files(struct ieee80211_sub_if_data *sdata) static void del_monitor_files(struct ieee80211_sub_if_data *sdata)
......
...@@ -470,6 +470,8 @@ struct ieee80211_sub_if_data { ...@@ -470,6 +470,8 @@ struct ieee80211_sub_if_data {
struct dentry *auth_transaction; struct dentry *auth_transaction;
struct dentry *flags; struct dentry *flags;
struct dentry *num_beacons_sta; struct dentry *num_beacons_sta;
struct dentry *force_unicast_rateidx;
struct dentry *max_ratectrl_rateidx;
} sta; } sta;
struct { struct {
struct dentry *drop_unencrypted; struct dentry *drop_unencrypted;
...@@ -483,9 +485,13 @@ struct ieee80211_sub_if_data { ...@@ -483,9 +485,13 @@ struct ieee80211_sub_if_data {
struct { struct {
struct dentry *drop_unencrypted; struct dentry *drop_unencrypted;
struct dentry *peer; struct dentry *peer;
struct dentry *force_unicast_rateidx;
struct dentry *max_ratectrl_rateidx;
} wds; } wds;
struct { struct {
struct dentry *drop_unencrypted; struct dentry *drop_unencrypted;
struct dentry *force_unicast_rateidx;
struct dentry *max_ratectrl_rateidx;
} vlan; } vlan;
struct { struct {
struct dentry *mode; struct dentry *mode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment