summaryrefslogtreecommitdiff
path: root/fs/btrfs/extent_io.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2015-03-17 00:38:02 +0300
committerJosef Bacik <jbacik@fb.com>2015-03-17 23:30:18 +0300
commitbcb7e449ec6350121ac7ca138c0b050ba7caca47 (patch)
tree105b57d8cf6f68e4787805b2e2db5be646f801c9 /fs/btrfs/extent_io.c
parentba117213554bc747561c5b7bf274d60ac93b8598 (diff)
downloadlinux-bcb7e449ec6350121ac7ca138c0b050ba7caca47.tar.xz
Btrfs: just free dummy extent buffers
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>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r--fs/btrfs/extent_io.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 29850d4a3827..d13ceadcbf18 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -4968,6 +4968,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;
}