linux/fs/btrfs/tests
Qu Wenruo 0c1032c8c3 btrfs: tests: do not touch page cache if root/inode allocation failed
Inside test_find_delalloc() of extent-io-tests.c, if we fail to allocate
a dummy root or the test inode, we go to out label to clean up.

But at that stage, @inode is still NULL and we will call
process_page_range() to access the page cache of the inode, this will
cause NULL pointer dereference.

This is a very minor bug, as it only affects selftests which are not
compiled in by default for most distros, and very hard to trigger.

Fix it by adding a new out_root_info label to handle root and inode
allocation failure.

This is a pre-existing bug reported by Sashiko while reviewing another
patch.

Link: https://sashiko.dev/#/patchset/cover.1786095309.git.wqu%40suse.com
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2026-09-02 22:19:30 +02:00
..
btrfs-tests.c btrfs: remove op field from struct btrfs_free_space_ctl 2026-06-08 15:53:29 +02:00
btrfs-tests.h btrfs: tests: zoned: add tests cases for zoned code 2026-04-07 18:55:52 +02:00
chunk-allocation-tests.c btrfs: tests: add unit tests for pending extent walking functions 2026-02-03 07:56:25 +01:00
delayed-refs-tests.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
extent-buffer-tests.c btrfs: abort transaction on generation mismatch when marking eb as dirty 2023-10-12 16:44:07 +02:00
extent-io-tests.c btrfs: tests: do not touch page cache if root/inode allocation failed 2026-09-02 22:19:30 +02:00
extent-map-tests.c btrfs: tests: prepare extent map tests for strict alignment checks 2026-02-03 07:56:19 +01:00
free-space-tests.c btrfs: remove op field from struct btrfs_free_space_ctl 2026-06-08 15:53:29 +02:00
free-space-tree-tests.c btrfs: use the btrfs_block_group_end() helper everywhere 2026-02-03 07:54:36 +01:00
inode-tests.c btrfs: tests: remove invalid file extent map tests 2026-02-03 07:56:19 +01:00
qgroup-tests.c btrfs: tests: fix root tree leak in btrfs_test_qgroups() 2026-01-09 17:41:45 +01:00
raid-stripe-tree-tests.c btrfs: selftests: add a selftest for deleting two out of three extents 2025-01-14 15:57:55 +01:00
zoned-tests.c btrfs: replace kcalloc() calls to kzalloc_objs() 2026-04-07 18:55:59 +02:00