]> git.hungrycats.org Git - linux/commitdiff
Btrfs: just free dummy extent buffers
authorJosef Bacik <jbacik@fb.com>
Mon, 16 Mar 2015 21:38:02 +0000 (17:38 -0400)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Fri, 17 Apr 2015 15:57:18 +0000 (11:57 -0400)
If we fail during our sanity tests we could get NULL deref's because we unload
the module before the dummy extent buffers are free'd via RCU.  So check for
this case and just free the things directly.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
(cherry picked from commit 2fdbf36f587e956eee26e193264b0e8d86d2fd08)

fs/btrfs/extent_io.c

index 5afef1e7a6164bd17dcbdc921b3572c9fb18ac02..83f4a11832929d91cfb6bb0eb1aa19fa47600349 100644 (file)
@@ -4926,6 +4926,12 @@ static int release_extent_buffer(struct extent_buffer *eb)
 
                /* Should be safe to release our pages at this point */
                btrfs_release_extent_buffer_page(eb);
+#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
+               if (unlikely(test_bit(EXTENT_BUFFER_DUMMY, &eb->bflags))) {
+                       __free_extent_buffer(eb);
+                       return 1;
+               }
+#endif
                call_rcu(&eb->rcu_head, btrfs_release_extent_buffer_rcu);
                return 1;
        }