This fixes missing unlocks noticed by sparse.
Signed-off-by: Johannes Berg <[email protected]>
---
net/mac80211/mesh_hwmp.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- everything.orig/net/mac80211/mesh_hwmp.c 2008-02-23 13:50:40.000000000 +0100
+++ everything/net/mac80211/mesh_hwmp.c 2008-02-23 13:51:11.000000000 +0100
@@ -264,8 +264,10 @@ static u32 hwmp_route_info_get(struct ne
rcu_read_lock();
sta = sta_info_get(local, mgmt->sa);
- if (!sta)
+ if (!sta) {
+ rcu_read_unlock();
return 0;
+ }
last_hop_metric = airtime_link_metric_get(local, sta);
/* Update and check originator routing info */
@@ -293,6 +295,7 @@ static u32 hwmp_route_info_get(struct ne
break;
default:
sta_info_put(sta);
+ rcu_read_unlock();
return 0;
}
new_metric = orig_metric + last_hop_metric;
--
On Mon, 2008-02-25 at 11:09 -0800, Luis Carlos Cobo wrote:
> On Sat, 2008-02-23 at 15:17 +0100, Johannes Berg wrote:
> > This fixes missing unlocks noticed by sparse.
>
> Thanks for the fix. It would be easier though to just acquire the lock
> later, since rcu_read_lock() is no longer needed to look for mesh peer
> links, like in this patch (applied to the original version of the file
> without the patch included in the mail I'm replying to).
> u8 action = mgmt->u.action.u.mesh_action.action_code;
>
> - rcu_read_lock();
> sta = sta_info_get(local, mgmt->sa);
> if (!sta)
> return 0;
Ah, but sta_info_get will require rcu locking after a few more patches
so I now that I posted both sets this is easier (otherwise the sta info
rcu-ification would have to add all the code and revert this patch)
johannes
On Sat, 2008-02-23 at 15:17 +0100, Johannes Berg wrote:
> This fixes missing unlocks noticed by sparse.
Thanks for the fix. It would be easier though to just acquire the lock
later, since rcu_read_lock() is no longer needed to look for mesh peer
links, like in this patch (applied to the original version of the file
without the patch included in the mail I'm replying to).
---
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -262,7 +262,6 @@ static u32 hwmp_route_info_get(struct net_device *dev,
bool process = true;
u8 action = mgmt->u.action.u.mesh_action.action_code;
- rcu_read_lock();
sta = sta_info_get(local, mgmt->sa);
if (!sta)
return 0;
@@ -300,6 +299,7 @@ static u32 hwmp_route_info_get(struct net_device *dev,
new_metric = MAX_METRIC;
exp_time = TU_TO_EXP_TIME(orig_lifetime);
+ rcu_read_lock();
if (memcmp(orig_addr, dev->dev_addr, ETH_ALEN) == 0) {
/* This MP is the originator, we are not interested in this
* frame, except for updating transmitter's path info.
--
Luis Carlos Cobo Rus GnuPG ID: 44019B60
cozybit Inc.
--
Luis Carlos Cobo Rus GnuPG ID: 44019B60
cozybit Inc.
On Mon, 2008-02-25 at 20:09 +0100, Johannes Berg wrote:
> Ah, but sta_info_get will require rcu locking after a few more patches
> so I now that I posted both sets this is easier (otherwise the sta info
> rcu-ification would have to add all the code and revert this patch)
You're right, just noticed the sta rcu-ification process.
--
Luis Carlos Cobo Rus GnuPG ID: 44019B60
cozybit Inc.