Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] test_objagg: Fix objagg and hints refcount leak when create objagg2 failed
@ 2021-09-07 12:12 Chenyuan Mi
0 siblings, 0 replies; only message in thread
From: Chenyuan Mi @ 2021-09-07 12:12 UTC (permalink / raw)
Cc: yuanxzhang, Chenyuan Mi, Xiyu Yang, Xin Tan, Jiri Pirko, netdev,
linux-kernel
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@fudan.edu.cn>
Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-07 12:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07 12:12 [PATCH] test_objagg: Fix objagg and hints refcount leak when create objagg2 failed Chenyuan Mi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).