]> 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 10:14:01 +0000 (12:14 +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 d79d8041b8b7358dfedc03ea679f1276d84c9b1b..eb84b9418ac1144f65b0e9d8c9e86769f94d0701 100644 (file)
@@ -623,6 +623,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;