[PATCH] lib: objagg: Fix stats imbalance on hinted-parent error path
From: tongzhiwei
Date: Fri Nov 06 2026 - 05:10:26 EST
NOTE: this commit is worked by llm completely
In objagg_obj_init_with_hints(), the parent is obtained via
__objagg_obj_get() which increments only the refcount without
touching stats. The matching release for internal references is
__objagg_obj_put() (no stats adjustment), as used in the success
path in objagg_obj_parent_unassign().
However, the error cleanup at err_parent_assign calls the public
objagg_obj_put(), which additionally runs objagg_obj_stats_dec(),
decrementing user_count and delta_user_count with no prior
increment. This corrupts the parent stats, leading to
under-reporting and potential user_count underflow.
Use __objagg_obj_put() to match the internal __objagg_obj_get().
Assisted-by: LLM
Signed-off-by: tongzhiwei <tongzhiwei@xxxxxxxxxxxxxxxxxxxx>
---
lib/objagg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/objagg.c b/lib/objagg.c
index 23c7105a3f9f..6c4144213eb8 100644
--- a/lib/objagg.c
+++ b/lib/objagg.c
@@ -327,7 +327,7 @@ static int objagg_obj_init_with_hints(struct objagg *objagg,
return 0;
err_parent_assign:
- objagg_obj_put(objagg, parent);
+ __objagg_obj_put(objagg, parent);
return err;
}
--
2.43.0