Skip to contentSkip to conversation

Btrfs: just free dummy extent buffers

PATCH New Josef Bacik 1 participant 1 message Mar 16, 2015 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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,

---
 fs/btrfs/extent_io.c | 6 ++++++
 1 file changed, 6 insertions(+)
fs/btrfs/extent_io.c +6 -0
index 29850d4..d13cead 100644
@@ -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;
 	}
Signature · 1 line
1.9.3