summaryrefslogtreecommitdiff
path: root/net/batman-adv/bridge_loop_avoidance.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-01-17 06:01:51 (GMT)
committerDavid S. Miller <davem@davemloft.net>2016-01-17 06:01:51 (GMT)
commit78c5b2c66758f2dad354fcc59c529954e07f078e (patch)
tree6d7d64bc6e77a67f067c87b1cc1c58d364738790 /net/batman-adv/bridge_loop_avoidance.c
parent6c3f5aef1159a278b54642ebc0bbb5cdab7630cf (diff)
parent42eff6a617e23b691f8e4467f4687ed7245a92db (diff)
downloadlinux-78c5b2c66758f2dad354fcc59c529954e07f078e.tar.xz
Merge tag 'batman-adv-fix-for-davem' of git://git.open-mesh.org/linux-merge
Antonio Quartulli says: ==================== pull request [net]: batman-adv 20160117 here you have a bunch of patches intended for net. This patchset is provided by Sven Eckelmann and it is basically fixing 2 major issues that exist in several parts of the code - that is why we have 8 patches. The first bugfix (patch 1 and 2) is preventing call_rcu from being invoked recursively. This would deceive any user waiting on rcu_barrier() because the latter won't be able to wait for the nested invocation thus triggering any sort of undefined behaviours. The second bugfix (patches from 3 to 8) prevents the code from freeing rcu protected objects without waiting for the proper grace period. This issue can potentially lead to wrong memory access and thus kernel crashes. Unfortunately this bogus code pattern was copy/pasted all around the place when developing new features, therefore Sven diligently created several patches to address each component independently. Given that such bugs were introduced quite some time ago, all the patches except patch 5 should be considered for submission to stable. Included changes: - avoid recursive invocations of call_rcu() which would fool users waiting on rcu_barrier() - prevent immediate kfree of objects used in rcu protected contexts ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/batman-adv/bridge_loop_avoidance.c')
-rw-r--r--net/batman-adv/bridge_loop_avoidance.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index d5d71ac..c24c481 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -127,21 +127,17 @@ batadv_backbone_gw_free_ref(struct batadv_bla_backbone_gw *backbone_gw)
}
/* finally deinitialize the claim */
-static void batadv_claim_free_rcu(struct rcu_head *rcu)
+static void batadv_claim_release(struct batadv_bla_claim *claim)
{
- struct batadv_bla_claim *claim;
-
- claim = container_of(rcu, struct batadv_bla_claim, rcu);
-
batadv_backbone_gw_free_ref(claim->backbone_gw);
- kfree(claim);
+ kfree_rcu(claim, rcu);
}
/* free a claim, call claim_free_rcu if its the last reference */
static void batadv_claim_free_ref(struct batadv_bla_claim *claim)
{
if (atomic_dec_and_test(&claim->refcount))
- call_rcu(&claim->rcu, batadv_claim_free_rcu);
+ batadv_claim_release(claim);
}
/**