]> www.infradead.org Git - users/hch/block.git/commitdiff
blk-cgroup: fix error unwinding in blkcg_init_queue
authorChristoph Hellwig <hch@lst.de>
Fri, 9 Sep 2022 11:36:23 +0000 (13:36 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 9 Sep 2022 11:36:53 +0000 (13:36 +0200)
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>
block/blk-cgroup.c

index 869af9d72bcf8cb4c9d036d9e3a25a77421f6307..3a88f8c011d2757d16f76661095e876ca2e2995d 100644 (file)
@@ -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;