Skip to content

Commit 614b266

Browse files
Yufen Yugregkh
authored andcommitted
blkcg: fix memleak for iolatency
[ Upstream commit 27029b4 ] Normally, blkcg_iolatency_exit() will free related memory in iolatency when cleanup queue. But if blk_throtl_init() return error and queue init fail, blkcg_iolatency_exit() will not do that for us. Then it cause memory leak. Fixes: d706751 ("block: introduce blk-iolatency io controller") Signed-off-by: Yufen Yu <yuyufen@huawei.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b5ce818 commit 614b266

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎block/blk-cgroup.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,13 +1056,15 @@ int blkcg_init_queue(struct request_queue *q)
10561056
if (preloaded)
10571057
radix_tree_preload_end();
10581058

1059-
ret = blk_iolatency_init(q);
1059+
ret = blk_throtl_init(q);
10601060
if (ret)
10611061
goto err_destroy_all;
10621062

1063-
ret = blk_throtl_init(q);
1064-
if (ret)
1063+
ret = blk_iolatency_init(q);
1064+
if (ret) {
1065+
blk_throtl_exit(q);
10651066
goto err_destroy_all;
1067+
}
10661068
return 0;
10671069

10681070
err_destroy_all:

0 commit comments

Comments
 (0)