Skip to content

Commit 368449e

Browse files
ecsvgregkh
authored andcommitted
batman-adv: bla: prevent use-after-free when deleting claims
commit 4ae1709 upstream. When batadv_bla_del_backbone_claims() removes all claims for a backbone, it does this by dropping the link entry in the hash list. This list entry itself was one of the references which need to be dropped at the same time via batadv_claim_put(). But the batadv_claim_put() must not be done before the last access to the claim object in this function. Otherwise the claim might be freed already by the batadv_claim_release() function before the list entry was dropped. Cc: stable@kernel.org Fixes: 2372138 ("batman-adv: add basic bridge loop avoidance code") Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent aafcbaf commit 368449e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

net/batman-adv/bridge_loop_avoidance.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ batadv_bla_del_backbone_claims(struct batadv_bla_backbone_gw *backbone_gw)
318318
if (claim->backbone_gw != backbone_gw)
319319
continue;
320320

321-
batadv_claim_put(claim);
322321
hlist_del_rcu(&claim->hash_entry);
322+
batadv_claim_put(claim);
323323
}
324324
spin_unlock_bh(list_lock);
325325
}

0 commit comments

Comments
 (0)