From 03c90afb21b45edb87533fa6f11c5f914d26298b Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 19 Mar 2025 14:36:33 -0600 Subject: [PATCH] block/blk-iocost: ensure 'ret' is set on error 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 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 --- block/blk-iocost.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 3724b0308cd8..f798f2c9ca35 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -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; -- 2.25.1