]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
block/blk-iocost: ensure 'ret' is set on error
authorJens Axboe <axboe@kernel.dk>
Wed, 19 Mar 2025 20:36:33 +0000 (14:36 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 19 Mar 2025 20:51:36 +0000 (14:51 -0600)
In case blkg_conf_open_bdev_frozen() fails, ioc_qos_write() jumps to the
error path without assigning a value to 'ret'. Ensure that it inherits
the error from the passed back error value.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202503200454.QWpwKeJu-lkp@intel.com/
Fixes: 9730763f4756 ("block: correct locking order for protecting blk-wbt parameters")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-iocost.c

index 3724b0308cd88d34625923a8e48a1bb346bbc9d5..f798f2c9ca35a3d039d65ffcf3622b0ac035979d 100644 (file)
@@ -3229,8 +3229,10 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input,
        blkg_conf_init(&ctx, input);
 
        memflags = blkg_conf_open_bdev_frozen(&ctx);
-       if (IS_ERR_VALUE(memflags))
+       if (IS_ERR_VALUE(memflags)) {
+               ret = memflags;
                goto err;
+       }
 
        body = ctx.body;
        disk = ctx.bdev->bd_disk;