[PATCH] lib: objagg: Fix stats imbalance on hinted-parent error path

From
tongzhiwei <hidden>
Date
2026-11-06 09:56:54
Also in
lkml
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 <redacted>
---
 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


Thread (2 messages) 2 messages, 2 authors, last reply 10d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help