]> git.itanic.dy.fi Git - linux-stable/commit
btrfs: scrub: reject unsupported scrub flags
authorQu Wenruo <wqu@suse.com>
Thu, 6 Apr 2023 05:00:34 +0000 (13:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:13:21 +0000 (11:13 +0200)
commitfdca36e1689c5ee68de9ee09a42e0b311c7e2160
treedfd71e6007da2b79e45dbd7ed7377a797e94b05d
parent24637afbe756cdb1f09168c05a8babb5dd3bc518
btrfs: scrub: reject unsupported scrub flags

commit 604e6681e114d05a2e384c4d1e8ef81918037ef5 upstream.

Since the introduction of scrub interface, the only flag that we support
is BTRFS_SCRUB_READONLY.  Thus there is no sanity checks, if there are
some undefined flags passed in, we just ignore them.

This is problematic if we want to introduce new scrub flags, as we have
no way to determine if such flags are supported.

Address the problem by introducing a check for the flags, and if
unsupported flags are set, return -EOPNOTSUPP to inform the user space.

This check should be backported for all supported kernels before any new
scrub flags are introduced.

CC: stable@vger.kernel.org # 4.14+
Reviewed-by: Anand Jain <anand.jain@oracle.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