btrfs: do not allow non subvolume root targets for snapshot
authorJosef Bacik <josef@toxicpanda.com>
Fri, 15 Dec 2023 15:01:44 +0000 (10:01 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Dec 2023 16:02:01 +0000 (17:02 +0100)
commit654461744af8c33ee6943b7937272e5a4945e5c9
tree3a923e01268260192c28c038622178d7b8928054
parent545d55a3e0c8f4e59fbc9d92c99ef5725c799014
btrfs: do not allow non subvolume root targets for snapshot

commit a8892fd71933126ebae3d60aec5918d4dceaae76 upstream.

Our btrfs subvolume snapshot <source> <destination> utility enforces
that <source> is the root of the subvolume, however this isn't enforced
in the kernel.  Update the kernel to also enforce this limitation to
avoid problems with other users of this ioctl that don't have the
appropriate checks in place.

Reported-by: Martin Michaelis <code@mgjm.de>
CC: stable@vger.kernel.org # 4.14+
Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Josef Bacik <josef@toxicpanda.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