]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: check folio mapping after unlock in put_file_data()
authorBoris Burkov <boris@bur.io>
Fri, 13 Dec 2024 20:33:22 +0000 (12:33 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Jan 2025 09:34:25 +0000 (10:34 +0100)
commitdd8bbfe723778bfcb49256ac15c66eae966b8632
treec73ac951d91f92a33eaa4b1dec35fdb5922bf9e2
parentc3a403d8ce36f5a809a492581de5ad17843e4701
btrfs: check folio mapping after unlock in put_file_data()

commit 0fba7be1ca6df2881e68386e5575fe096f33c4ca upstream.

When we call btrfs_read_folio() we get an unlocked folio, so it is possible
for a different thread to concurrently modify folio->mapping. We must
check that this hasn't happened once we do have the lock.

CC: stable@vger.kernel.org # 6.12+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/send.c