OSDN Git Service

blkcg: fix double free of new_blkg in blkcg_init_queue
authorHou Tao <houtao1@huawei.com>
Fri, 3 Feb 2017 09:19:07 +0000 (17:19 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Mar 2018 08:23:19 +0000 (09:23 +0100)
commit 9b54d816e00425c3a517514e0d677bb3cec49258 upstream.

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>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
block/blk-cgroup.c

index 8161090..46ba240 100644 (file)
@@ -1078,10 +1078,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;