Skip to content

Commit 33dc627

Browse files
Christoph Hellwigaxboe
authored andcommitted
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 <hch@lst.de> Reviewed-by: Andreas Herrmann <aherrmann@suse.de> Acked-by: Tejun Heo <tj@kernel.org> Link: https://lore.kernel.org/r/20220921180501.1539876-2-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent f168420 commit 33dc627

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

block/blk-cgroup.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,17 +1297,18 @@ int blkcg_init_queue(struct request_queue *q)
12971297

12981298
ret = blk_throtl_init(q);
12991299
if (ret)
1300-
goto err_destroy_all;
1300+
goto err_ioprio_exit;
13011301

13021302
ret = blk_iolatency_init(q);
1303-
if (ret) {
1304-
blk_throtl_exit(q);
1305-
blk_ioprio_exit(q);
1306-
goto err_destroy_all;
1307-
}
1303+
if (ret)
1304+
goto err_throtl_exit;
13081305

13091306
return 0;
13101307

1308+
err_throtl_exit:
1309+
blk_throtl_exit(q);
1310+
err_ioprio_exit:
1311+
blk_ioprio_exit(q);
13111312
err_destroy_all:
13121313
blkg_destroy_all(q);
13131314
return ret;

0 commit comments

Comments
 (0)