]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
btrfs: scrub: reject unsupported scrub flags
authorQu Wenruo <wqu@suse.com>
Thu, 6 Apr 2023 05:00:34 +0000 (13:00 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 7 Jul 2023 10:17:14 +0000 (12:17 +0200)
commitcbbc681fa4245dc9618157b623c6f01d2ce852c2
tree5411da05c07a68bc24ecf1c601427a27e94de25a
parentc6a1dc21db8d8cdab561f0c4cb59be532f8450f9
btrfs: scrub: reject unsupported scrub flags

BugLink: https://bugs.launchpad.net/bugs/2025067
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
fs/btrfs/ioctl.c
include/uapi/linux/btrfs.h