Skip to content

Commit

Permalink
block/blk-iocost: ensure 'ret' is set on error
Browse files Browse the repository at this point in the history
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: 9730763 ("block: correct locking order for protecting blk-wbt parameters")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Jens Axboe committed Mar 19, 2025
1 parent 9730763 commit 03c90af
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion block/blk-iocost.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 03c90af

Please sign in to comment.