diff mbox

[RESEND] blkcg: fix double free of new_blkg in blkcg_init_queue

Message ID 1486113547-43833-1-git-send-email-houtao1@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Hou Tao Feb. 3, 2017, 9:19 a.m. UTC
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>
---
 block/blk-cgroup.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Jens Axboe Feb. 3, 2017, 3:25 p.m. UTC | #1
On 02/03/2017 02:19 AM, Hou Tao wrote:
> 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.

Thanks, looks good to me. Applied.
diff mbox

Patch

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 8ba0af7..f570f38 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -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;