]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
btrfs: fix folio refcount in __alloc_dummy_extent_buffer()
authorBoris Burkov <boris@bur.io>
Tue, 2 Jul 2024 14:31:14 +0000 (07:31 -0700)
committerDavid Sterba <dsterba@suse.com>
Thu, 4 Jul 2024 00:19:10 +0000 (02:19 +0200)
Another improper use of __folio_put() in an error path after freshly
allocating pages/folios which returns them with the refcount initialized
to 1. The refactor from __free_pages() -> __folio_put() (instead of
folio_put) removed a refcount decrement found in __free_pages() and
folio_put but absent from __folio_put().

Fixes: 13df3775efca ("btrfs: cleanup metadata page pointer usage")
CC: stable@vger.kernel.org # 6.8+
Tested-by: Ed Tomlinson <edtoml@gmail.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Boris Burkov <boris@bur.io>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c

index f688fab55251ea4e54ea576e59087034c675cff8..958155cc43a81cfb0f649093820f43eaa3430c41 100644 (file)
@@ -3553,7 +3553,7 @@ err:
        for (int i = 0; i < num_folios; i++) {
                if (eb->folios[i]) {
                        detach_extent_buffer_folio(eb, eb->folios[i]);
-                       __folio_put(eb->folios[i]);
+                       folio_put(eb->folios[i]);
                }
        }
        __free_extent_buffer(eb);