Skip to content

Commit 52abfcb

Browse files
krisman-at-collaboraaxboe
authored andcommitted
blk-cgroup: Fix memleak on error path
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>
1 parent 3650b22 commit 52abfcb

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
@@ -663,6 +663,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
663663
blkg = blkg_lookup_check(pos, pol, q);
664664
if (IS_ERR(blkg)) {
665665
ret = PTR_ERR(blkg);
666+
blkg_free(new_blkg);
666667
goto fail_unlock;
667668
}
668669

0 commit comments

Comments
 (0)