]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libfrog: fix incorrect FS_IOC_FSSETXATTR argument to ioctl()
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Fri, 5 Dec 2025 14:31:48 +0000 (15:31 +0100)
committerAndrey Albershteyn <aalbersh@kernel.org>
Tue, 9 Dec 2025 10:23:50 +0000 (11:23 +0100)
xfsprogs 6.17.0 has broken project quota due to incorrect argument
passed to FS_IOC_FSSETXATTR ioctl(). Instead of passing struct fsxattr,
struct file_attr was passed.

# LC_ALL=C /usr/sbin/xfs_quota -x -c "project -s -p /home/xxx 389701" /home
Setting up project 389701 (path /home/xxx)...
xfs_quota: cannot set project on /home/xxx: Invalid argument
Processed 1 (/etc/projects and cmdline) paths for project 389701 with
recursion depth infinite (-1).

ioctl(5, FS_IOC_FSSETXATTR, {fsx_xflags=FS_XFLAG_PROJINHERIT|FS_XFLAG_HASATTR, fsx_extsize=0, fsx_projid=0, fsx_cowextsize=389701}) = -1 EINVAL (Invalid argument)

There seems to be a double mistake which hides the original ioctl()
argument bug on old kernel with xfsprogs built against it. The size of
fa_xflags was also wrong in xfsprogs's linux.h header. This way when
xfsprogs is compiled on newer kernel but used with older kernel this bug
uncovers.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Arkadiusz Miśkiewicz <arekm@maven.pl>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
include/linux.h
libfrog/file_attr.c

index cea468d2b9d87131a161e5110c0c11491252dc3f..3ea9016272e6884513ea6c2f1ec5f625f2a5bef4 100644 (file)
@@ -214,7 +214,7 @@ struct fsxattr {
  * fsxattr
  */
 struct file_attr {
-       __u32   fa_xflags;
+       __u64   fa_xflags;
        __u32   fa_extsize;
        __u32   fa_nextents;
        __u32   fa_projid;
index c2cbcb4e14659c6db5f673b684b39ad758f92ffd..6801c5458826f6ac1cbc3b4b16118453af3acdfa 100644 (file)
@@ -114,7 +114,7 @@ xfrog_file_setattr(
 
        file_attr_to_fsxattr(fa, &fsxa);
 
-       error = ioctl(fd, FS_IOC_FSSETXATTR, fa);
+       error = ioctl(fd, FS_IOC_FSSETXATTR, &fsxa);
        close(fd);
 
        return error;