Skip to content

Commit

Permalink
blkcg: fix double free of new_blkg in blkcg_init_queue
Browse files Browse the repository at this point in the history
If blkg_create fails, new_blkg passed as an argument will
be freed by blkg_create, so there is no need to free it again.

Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Hou Tao authored and Jens Axboe committed Feb 3, 2017
1 parent 0cacba6 commit 9b54d81
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions block/blk-cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1079,10 +1079,8 @@ int blkcg_init_queue(struct request_queue *q)
if (preloaded)
radix_tree_preload_end();

if (IS_ERR(blkg)) {
blkg_free(new_blkg);
if (IS_ERR(blkg))
return PTR_ERR(blkg);
}

q->root_blkg = blkg;
q->root_rl.blkg = blkg;
Expand Down

0 comments on commit 9b54d81

Please sign in to comment.