@@ -1811,7 +1811,7 @@ static noinline int btrfs_ioctl_snap_create_v2(struct file *file,
if (vol_args->flags & BTRFS_SUBVOL_RDONLY)
readonly = true;
if (vol_args->flags & BTRFS_SUBVOL_QGROUP_INHERIT) {
- if (vol_args->size > PAGE_SIZE) {
+ if (vol_args->size > BTRFS_QGROUP_INHERIT_MAX_SIZE) {
ret = -EINVAL;
goto free_args;
}
@@ -82,6 +82,7 @@ struct btrfs_qgroup_limit {
*/
#define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0)
+#define BTRFS_QGROUP_INHERIT_MAX_SIZE (SZ_4K)
struct btrfs_qgroup_inherit {
__u64 flags;
__u64 num_qgroups;
Change btrfs_qgroup_inherit maximum size from PAGE_SIZE to SZ_4K to make it consistent across different architectures. Although in theory this could lead to incompatibility, but considering how rare btrfs_qgroup_inherit is used, it's still not too late to change it without impacting a large user base. Signed-off-by: Qu Wenruo <wqu@suse.com> --- fs/btrfs/ioctl.c | 2 +- include/uapi/linux/btrfs.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)