• Chao Yu's avatar
    f2fs: support FS_IOC_{GET,SET}FSLABEL · 4507847c
    Chao Yu authored
    Support two generic fs ioctls FS_IOC_{GET,SET}FSLABEL, letting
    f2fs pass generic/492 testcase.
    
    Fixes were made by Eric where:
     - f2fs: fix buffer overruns in FS_IOC_{GET, SET}FSLABEL
       utf16s_to_utf8s() and utf8s_to_utf16s() take the number of characters,
       not the number of bytes.
    
     - f2fs: fix copying too many bytes in FS_IOC_SETFSLABEL
       Userspace provides a null-terminated string, so don't assume that the
       full FSLABEL_MAX bytes can always be copied.
    
     - f2fs: add missing authorization check in FS_IOC_SETFSLABEL
       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.
    Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
    Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
    Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
    4507847c
f2fs.h 116 KB