btrfs: defrag: reject unknown flags of btrfs_ioctl_defrag_range_args
authorQu Wenruo <wqu@suse.com>
Tue, 9 Jan 2024 22:28:26 +0000 (08:58 +1030)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Feb 2024 00:19:06 +0000 (16:19 -0800)
commit5556a872e9e9aca4ee3f21d1d11da51c45229048
tree7cdbbaee29dd93087891e79c1ebf46d347f5ba1b
parentbe725b06a4c39cc4e07d1e57c0c2ce64db411ccf
btrfs: defrag: reject unknown flags of btrfs_ioctl_defrag_range_args

commit 173431b274a9a54fc10b273b46e67f46bcf62d2e upstream.

Add extra sanity check for btrfs_ioctl_defrag_range_args::flags.

This is not really to enhance fuzzing tests, but as a preparation for
future expansion on btrfs_ioctl_defrag_range_args.

In the future we're going to add new members, allowing more fine tuning
for btrfs defrag.  Without the -ENONOTSUPP error, there would be no way
to detect if the kernel supports those new defrag features.

CC: stable@vger.kernel.org # 4.14+
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/ioctl.c
include/uapi/linux/btrfs.h