diff mbox series

[v3,1/5] blk-iocost: check return value of match_u64()

Message ID 20221226085859.2701195-2-yukuai1@huaweicloud.com (mailing list archive)
State New, archived
Headers show
Series blk-iocost: random bugfix | expand

Commit Message

Yu Kuai Dec. 26, 2022, 8:58 a.m. UTC
From: Yu Kuai <yukuai3@huawei.com>

This patch fixs that the return value of match_u64() from ioc_qos_write()
is not checked,

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 block/blk-iocost.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Tejun Heo Jan. 4, 2023, 9:48 p.m. UTC | #1
On Mon, Dec 26, 2022 at 04:58:55PM +0800, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@huawei.com>
> 
> This patch fixs that the return value of match_u64() from ioc_qos_write()
> is not checked,
> 
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.
diff mbox series

Patch

diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index 549ddc9e0c6f..93b938517be3 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -3212,7 +3212,8 @@  static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input,
 
 		switch (match_token(p, qos_ctrl_tokens, args)) {
 		case QOS_ENABLE:
-			match_u64(&args[0], &v);
+			if (match_u64(&args[0], &v))
+				goto einval;
 			enable = v;
 			continue;
 		case QOS_CTRL: