🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
3 messages
3 total messages Started by tongzhiwei Fri, 06 Nov 2026 09:55
[PATCH] lib: objagg: Fix stats imbalance on hinted-parent error path
#12133
Author: tongzhiwei
Date: Fri, 06 Nov 2026 09:55
38 lines
9519 bytes
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
Re: [PATCH] lib: objagg: Fix stats imbalance on hinted-parent error path
#12177
Author: Jiri Pirko
Date: Fri, 06 Nov 2026 12:31
22 lines
11626 bytes
Fri, Nov 06, 2026 at 10:55:58AM +0100, tongzhiwei@cmss.chinamobile.com wrote:
>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>

Reviewed-by: Jiri Pirko <jiri@nvidia.com>
[PATCH net-next v2] lib: objagg: Fix stats imbalance on hinted-parent error path
#23387
Author: tongzhiwei
Date: Fri, 27 Nov 2026 07:14
62 lines
10926 bytes
This issue was discovered by an AI code review agent during static
inspection of the hinted-parent error path.  It has not been
triggered or observed at runtime; the analysis was confirmed by
inspecting the code, pairing __objagg_obj_get() with
__objagg_obj_put() on the success path.  The fix has not been
runtime-tested.  Its only build validation is the automated netdev
build tests run on the v1 submission (identical diff), which passed
with no new warnings.  The fix and this commit message were
prepared by the same LLM agent and reviewed by the human submitter.

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().

Fixes: 9069a3817d82 ("lib: objagg: implement optimization hints assembly and use hints for object creation")
Signed-off-by: tongzhiwei <tongzhiwei@cmss.chinamobile.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
---
V1 -> V2:
- add the net-next tree designation to the subject
- add the Fixes: tag for the commit that introduced the
  hinted-parent error path
- collect the Reviewed-by tag from Jiri Pirko.  Thank you for the
  review, and sorry for the slow follow-up!  The diff is unchanged,
  so the tag is carried over as-is
- replace the "NOTE: this commit is worked by llm completely" line
  and the "Assisted-by: LLM" trailer with the plain-English
  discovery and testing statement above, per the "Bug fixes"
  section of Documentation/process/maintainer-netdev.rst
- no code changes

v1: https://lore.kernel.org/r/20261106095621.143-1-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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads