Skip to content

Commit

Permalink
cache: cache_include(): fix double put for cloned objects
Browse files Browse the repository at this point in the history
When switching to auto obj, a nl_object_put() was left inplace in
cache_include(). This leads to a double reference drop of the cloned
object, leading to use after free later or triggering an assert that
the reference count went negative.

Fixes: 831e986 ("cache: use the new _nl_auto_nl_object helper")
Signed-off-by: Jonas Gorski <[email protected]>
  • Loading branch information
KanjiMonster committed Dec 17, 2024
1 parent 49518ca commit 1377e00
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,6 @@ static int cache_include(struct nl_cache *cache, struct nl_object *obj,
if (cb_v2) {
cb_v2(cache, clone, old, diff,
NL_ACT_CHANGE, data);
nl_object_put(clone);
} else if (cb)
cb(cache, old, NL_ACT_CHANGE, data);
return 0;
Expand Down

0 comments on commit 1377e00

Please sign in to comment.