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 <[email protected]> Signed-off-by: Gabriel Krisman Bertazi <[email protected]> Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 9070c2b commit 89c94a3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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)