summary refs log tree commit diff
path: root/kernel/capability.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-07-24 06:26:55 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-16 18:27:29 +0200
commit7112abc9e8f2893328cbb2e055c3e21133cc7a3b (patch)
tree0dcd37ffbac7b7cc7b841ecb3bacebbc88c425d0 /kernel/capability.c
parent504d81c512f614ce6aa3d4857e6587580e445a1d (diff)
downloadlinux-7112abc9e8f2893328cbb2e055c3e21133cc7a3b.tar.gz
btrfs: properly clear end of the unreserved range in cow_file_range
commit 12b2d64e591652a2d97dd3afa2b062ca7a4ba352 upstream.

When the call to btrfs_reloc_clone_csums in cow_file_range returns an
error, we jump to the out_unlock label with the extent_reserved variable
set to false.   The cleanup at the label will then call
extent_clear_unlock_delalloc on the range from start to end.  But we've
already added cur_alloc_size to start before the jump, so there might no
range be left from the newly incremented start to end.  Move the check for
'start < end' so that it is reached by also for the !extent_reserved case.

CC: stable@vger.kernel.org # 6.1+
Fixes: a315e68f6e8b ("Btrfs: fix invalid attempt to free reserved space on failure to cow range")
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/capability.c')
0 files changed, 0 insertions, 0 deletions