mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] lib: objagg: Fix stats imbalance on hinted-parent error path
@ 2026-11-06  9:55 tongzhiwei
  2026-11-06 12:31 ` Jiri Pirko
  0 siblings, 1 reply; 2+ messages in thread
From: tongzhiwei @ 2026-11-06  9:55 UTC (permalink / raw)
  To: Jiri Pirko, Andrew Morton; +Cc: tongzhiwei, linux-kernel, netdev

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@cmss.chinamobile.com>
---
 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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-06 12:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-06  9:55 [PATCH] lib: objagg: Fix stats imbalance on hinted-parent error path tongzhiwei
2026-11-06 12:31 ` Jiri Pirko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®