mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
batman-adv: bla: avoid double free after failed backbone_hash alloc
When batadv_bla_init() fails to initialize the backbone_hash, it is freeing the (previously) allocated claim_hash. The initialization function will then return an error and the net_device initialization will stop. The destructor will be called instead and (indirectly via batadv_mesh_free() -> batadv_bla_free()) will try to free the bat_priv->bla.claim_hash again. The pointer must therefore be set to NULL after freeing it in the initialization error path. Reported-by: Sashiko <sashiko-bot@kernel.org> Closes: https://sashiko.dev/#/patchset/20260831135117.574836-1-sw%40simonwunderlich.de?part=6 Signed-off-by: Sven Eckelmann <sven@narfation.org>
This commit is contained in:
parent
6d7f71ae4c
commit
4c0a6a5b77
|
|
@ -1625,6 +1625,7 @@ int batadv_bla_init(struct batadv_priv *bat_priv)
|
|||
bat_priv->bla.backbone_hash = batadv_hash_new(32);
|
||||
if (!bat_priv->bla.backbone_hash) {
|
||||
batadv_hash_destroy(bat_priv->bla.claim_hash);
|
||||
bat_priv->bla.claim_hash = NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user