[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210907121248.28236-1-cymi20@fudan.edu.cn>
Date: Tue, 7 Sep 2021 20:12:48 +0800
From: Chenyuan Mi <cymi20@...an.edu.cn>
To: unlisted-recipients:; (no To-header on input)
Cc: yuanxzhang@...an.edu.cn, Chenyuan Mi <cymi20@...an.edu.cn>,
Xiyu Yang <xiyuyang19@...an.edu.cn>,
Xin Tan <tanxin.ctf@...il.com>, Jiri Pirko <jiri@...dia.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] test_objagg: Fix objagg and hints refcount leak when create objagg2 failed
The reference couting issue happens in one exception handling path of
test_hints_case(). When failing to create objagg2, the function forgets
to decrease the refcount of both objagg and hints, causing a refcount leak.
Fix this issue by jumping to the label "err_check_expect_hints_stats".
Signed-off-by: Chenyuan Mi <cymi20@...an.edu.cn>
Signed-off-by: Xiyu Yang <xiyuyang19@...an.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@...il.com>
---
lib/test_objagg.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/test_objagg.c b/lib/test_objagg.c
index da137939a410..a7ee118c58aa 100644
--- a/lib/test_objagg.c
+++ b/lib/test_objagg.c
@@ -954,7 +954,8 @@ static int test_hints_case(const struct hints_case *hints_case)
objagg2 = objagg_create(&delta_ops, hints, &world2);
if (IS_ERR(objagg2))
- return PTR_ERR(objagg2);
+ err = PTR_ERR(objagg2);
+ goto err_check_expect_hints_stats
for (i = 0; i < hints_case->key_ids_count; i++) {
objagg_obj = world_obj_get(&world2, objagg2,
--
2.17.1
Powered by blists - more mailing lists