From: Eric Biggers <ebigg...@google.com>

FS_IOC_SETFSLABEL modifies the filesystem superblock, so it shouldn't be
allowed to regular users.  Require CAP_SYS_ADMIN, like xfs and btrfs do.

Fixes: 61a3da4d5ef8 ("f2fs: support FS_IOC_{GET,SET}FSLABEL")
Signed-off-by: Eric Biggers <ebigg...@google.com>
---
 fs/f2fs/file.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 315127251bc1..6939cddc542a 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -3113,6 +3113,9 @@ static int f2fs_set_volume_name(struct file *filp, 
unsigned long arg)
        char *vbuf;
        int err = 0;
 
+       if (!capable(CAP_SYS_ADMIN))
+               return -EPERM;
+
        vbuf = strndup_user((const char __user *)arg, FSLABEL_MAX);
        if (IS_ERR(vbuf))
                return PTR_ERR(vbuf);
-- 
2.22.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to