]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
f2fs: fix to check upper boundary for gc_no_zoned_gc_percent
authorChao Yu <chao@kernel.org>
Fri, 27 Jun 2025 02:38:18 +0000 (10:38 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 14:39:18 +0000 (16:39 +0200)
[ Upstream commit a919ae794ad2dc6d04b3eea2f9bc86332c1630cc ]

This patch adds missing upper boundary check while setting
gc_no_zoned_gc_percent via sysfs.

Fixes: 9a481a1c16f4 ("f2fs: create gc_no_zoned_gc_percent and gc_boost_zoned_gc_percent")
Cc: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/sysfs.c

index 173ad1a7274667d6c3cfd7802aa7e67ea5da3755..5da0254e205789f3741b950f8439ce39a59e6730 100644 (file)
@@ -628,6 +628,13 @@ out:
                return count;
        }
 
+       if (!strcmp(a->attr.name, "gc_no_zoned_gc_percent")) {
+               if (t > 100)
+                       return -EINVAL;
+               *ui = (unsigned int)t;
+               return count;
+       }
+
        if (!strcmp(a->attr.name, "gc_boost_zoned_gc_percent")) {
                if (t > 100)
                        return -EINVAL;