Skip to content

Commit 89c94a3

Browse files
krisman-at-collaboragregkh
authored andcommitted
blk-cgroup: Fix memleak on error path
[ Upstream commit 52abfcb ] If new_blkg allocation raced with blk_policy change and blkg_lookup_check fails, new_blkg is leaked. Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 9070c2b commit 89c94a3

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

block/blk-cgroup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
654654
blkg = blkg_lookup_check(pos, pol, q);
655655
if (IS_ERR(blkg)) {
656656
ret = PTR_ERR(blkg);
657+
blkg_free(new_blkg);
657658
goto fail_unlock;
658659
}
659660

0 commit comments

Comments
 (0)