From: Christoph Hellwig Date: Wed, 21 Sep 2022 18:04:45 +0000 (+0200) Subject: blk-cgroup: fix error unwinding in blkcg_init_queue X-Git-Tag: v6.1-rc5~283^2~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=33dc62796cb657a633050138a86253fb2a553713;p=platform%2Fkernel%2Flinux-starfive.git blk-cgroup: fix error unwinding in blkcg_init_queue When blk_throtl_init fails, we need to call blk_ioprio_exit. Switch to proper goto based unwinding to fix this. Signed-off-by: Christoph Hellwig Reviewed-by: Andreas Herrmann Acked-by: Tejun Heo Link: https://lore.kernel.org/r/20220921180501.1539876-2-hch@lst.de Signed-off-by: Jens Axboe --- diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 869af9d..3a88f8c 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -1297,17 +1297,18 @@ int blkcg_init_queue(struct request_queue *q) ret = blk_throtl_init(q); if (ret) - goto err_destroy_all; + goto err_ioprio_exit; ret = blk_iolatency_init(q); - if (ret) { - blk_throtl_exit(q); - blk_ioprio_exit(q); - goto err_destroy_all; - } + if (ret) + goto err_throtl_exit; return 0; +err_throtl_exit: + blk_throtl_exit(q); +err_ioprio_exit: + blk_ioprio_exit(q); err_destroy_all: blkg_destroy_all(q); return ret;