mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 09:31:14 +00:00
mac80211: fix debugfs lockup
When debugfs_create_dir fails, sta_info_debugfs_add_work will not terminate because it will find the same station again and again. This is possible whenever debugfs fails for whatever reason; one reason is a race condition in mac80211, unfortunately we cannot do much about it, so just document it, it just means some station may be missing from debugfs. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Cc: Robin Holt <holt@sgi.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
45527c2c4f
commit
63044e9f54
3 changed files with 18 additions and 1 deletions
|
@ -249,11 +249,22 @@ void ieee80211_sta_debugfs_add(struct sta_info *sta)
|
||||||
DECLARE_MAC_BUF(mbuf);
|
DECLARE_MAC_BUF(mbuf);
|
||||||
u8 *mac;
|
u8 *mac;
|
||||||
|
|
||||||
|
sta->debugfs.add_has_run = true;
|
||||||
|
|
||||||
if (!stations_dir)
|
if (!stations_dir)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mac = print_mac(mbuf, sta->sta.addr);
|
mac = print_mac(mbuf, sta->sta.addr);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This might fail due to a race condition:
|
||||||
|
* When mac80211 unlinks a station, the debugfs entries
|
||||||
|
* remain, but it is already possible to link a new
|
||||||
|
* station with the same address which triggers adding
|
||||||
|
* it to debugfs; therefore, if the old station isn't
|
||||||
|
* destroyed quickly enough the old station's debugfs
|
||||||
|
* dir might still be around.
|
||||||
|
*/
|
||||||
sta->debugfs.dir = debugfs_create_dir(mac, stations_dir);
|
sta->debugfs.dir = debugfs_create_dir(mac, stations_dir);
|
||||||
if (!sta->debugfs.dir)
|
if (!sta->debugfs.dir)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -635,7 +635,12 @@ static void sta_info_debugfs_add_work(struct work_struct *work)
|
||||||
|
|
||||||
spin_lock_irqsave(&local->sta_lock, flags);
|
spin_lock_irqsave(&local->sta_lock, flags);
|
||||||
list_for_each_entry(tmp, &local->sta_list, list) {
|
list_for_each_entry(tmp, &local->sta_list, list) {
|
||||||
if (!tmp->debugfs.dir) {
|
/*
|
||||||
|
* debugfs.add_has_run will be set by
|
||||||
|
* ieee80211_sta_debugfs_add regardless
|
||||||
|
* of what else it does.
|
||||||
|
*/
|
||||||
|
if (!tmp->debugfs.add_has_run) {
|
||||||
sta = tmp;
|
sta = tmp;
|
||||||
__sta_info_pin(sta);
|
__sta_info_pin(sta);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -300,6 +300,7 @@ struct sta_info {
|
||||||
struct dentry *inactive_ms;
|
struct dentry *inactive_ms;
|
||||||
struct dentry *last_seq_ctrl;
|
struct dentry *last_seq_ctrl;
|
||||||
struct dentry *agg_status;
|
struct dentry *agg_status;
|
||||||
|
bool add_has_run;
|
||||||
} debugfs;
|
} debugfs;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue