mac80211: RCU-ify STA info structure access

This makes access to the STA hash table/list use RCU to protect
against freeing of items. However, it's not a true RCU, the
copy step is missing: whenever somebody changes a STA item it
is simply updated. This is an existing race condition that is
now somewhat understandable.

This patch also fixes the race key freeing vs. STA destruction
by making sure that sta_info_destroy() is always called under
RTNL and frees the key.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Johannes Berg
2008-02-25 16:27:46 +01:00
committed by John W. Linville
parent 5cf121c3cd
commit d0709a6518
25 changed files with 707 additions and 492 deletions

View File

@@ -294,7 +294,6 @@ static u32 hwmp_route_info_get(struct net_device *dev,
orig_metric = PREP_IE_METRIC(hwmp_ie);
break;
default:
sta_info_put(sta);
rcu_read_unlock();
return 0;
}
@@ -330,7 +329,6 @@ static u32 hwmp_route_info_get(struct net_device *dev,
mpath = mesh_path_lookup(orig_addr, dev);
if (!mpath) {
rcu_read_unlock();
sta_info_put(sta);
return 0;
}
spin_lock_bh(&mpath->state_lock);
@@ -372,7 +370,6 @@ static u32 hwmp_route_info_get(struct net_device *dev,
mpath = mesh_path_lookup(ta, dev);
if (!mpath) {
rcu_read_unlock();
sta_info_put(sta);
return 0;
}
spin_lock_bh(&mpath->state_lock);
@@ -391,7 +388,6 @@ static u32 hwmp_route_info_get(struct net_device *dev,
spin_unlock_bh(&mpath->state_lock);
}
sta_info_put(sta);
rcu_read_unlock();
return process ? new_metric : 0;
@@ -861,5 +857,5 @@ void mesh_path_timer(unsigned long data)
endmpathtimer:
rcu_read_unlock();
if (delete)
mesh_path_del(mpath->dst, mpath->dev);
mesh_path_del(mpath->dst, mpath->dev, false);
}