mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-16 09:56:46 +00:00
mac80211: fix mesh_path and sta_info get_by_idx functions
Skip properly entries whose dev does not match. Signed-off-by: Luis Carlos Cobo <luisca@cozybit.com> Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
a00de5d08b
commit
2a8ca29a88
@ -98,7 +98,7 @@ struct mesh_path *mesh_path_lookup(u8 *dst, struct net_device *dev)
|
|||||||
/**
|
/**
|
||||||
* mesh_path_lookup_by_idx - look up a path in the mesh path table by its index
|
* mesh_path_lookup_by_idx - look up a path in the mesh path table by its index
|
||||||
* @idx: index
|
* @idx: index
|
||||||
* @dev: local interface
|
* @dev: local interface, or NULL for all entries
|
||||||
*
|
*
|
||||||
* Returns: pointer to the mesh path structure, or NULL if not found.
|
* Returns: pointer to the mesh path structure, or NULL if not found.
|
||||||
*
|
*
|
||||||
@ -111,7 +111,9 @@ struct mesh_path *mesh_path_lookup_by_idx(int idx, struct net_device *dev)
|
|||||||
int i;
|
int i;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
for_each_mesh_entry(mesh_paths, p, node, i)
|
for_each_mesh_entry(mesh_paths, p, node, i) {
|
||||||
|
if (dev && node->mpath->dev != dev)
|
||||||
|
continue;
|
||||||
if (j++ == idx) {
|
if (j++ == idx) {
|
||||||
if (MPATH_EXPIRED(node->mpath)) {
|
if (MPATH_EXPIRED(node->mpath)) {
|
||||||
spin_lock_bh(&node->mpath->state_lock);
|
spin_lock_bh(&node->mpath->state_lock);
|
||||||
@ -121,6 +123,7 @@ struct mesh_path *mesh_path_lookup_by_idx(int idx, struct net_device *dev)
|
|||||||
}
|
}
|
||||||
return node->mpath;
|
return node->mpath;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -115,12 +115,13 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_local *local, int idx,
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
list_for_each_entry_rcu(sta, &local->sta_list, list) {
|
list_for_each_entry_rcu(sta, &local->sta_list, list) {
|
||||||
|
if (dev && dev != sta->sdata->dev)
|
||||||
|
continue;
|
||||||
if (i < idx) {
|
if (i < idx) {
|
||||||
++i;
|
++i;
|
||||||
continue;
|
continue;
|
||||||
} else if (!dev || dev == sta->sdata->dev) {
|
|
||||||
return sta;
|
|
||||||
}
|
}
|
||||||
|
return sta;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user