]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
btrfs: add missing RCU unlock in error path in try_release_subpage_extent_buffer()
authorBart Van Assche <bvanassche@acm.org>
Wed, 25 Feb 2026 19:59:58 +0000 (11:59 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Mar 2026 15:15:28 +0000 (16:15 +0100)
commit b2840e33127ce0eea880504b7f133e780f567a9b upstream.

Call rcu_read_lock() before exiting the loop in
try_release_subpage_extent_buffer() because there is a rcu_read_unlock()
call past the loop.

This has been detected by the Clang thread-safety analyzer.

Fixes: ad580dfa388f ("btrfs: fix subpage deadlock in try_release_subpage_extent_buffer()")
CC: stable@vger.kernel.org # 6.18+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
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/extent_io.c

index f6cca3c97166f7858ad223addb1100abdd9fa6d2..3e6be1911237f48c8094fcbf00324002b22686af 100644 (file)
@@ -4475,6 +4475,7 @@ static int try_release_subpage_extent_buffer(struct folio *folio)
                 */
                if (!test_and_clear_bit(EXTENT_BUFFER_TREE_REF, &eb->bflags)) {
                        spin_unlock(&eb->refs_lock);
+                       rcu_read_lock();
                        break;
                }