bcachefs: Fix null ptr deref in bch2_backpointer_get_node()
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 7 Nov 2023 15:30:22 +0000 (10:30 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Tue, 14 Nov 2023 02:42:22 +0000 (21:42 -0500)
commit03cc1e67a243cbb2c85d5fd84f369449f94d4269
tree5aa73c5a8e96b44e93599c0ec558347c35dbc5d4
parent274c2f8fd27158d15524abe63c3df6fb96707dd3
bcachefs: Fix null ptr deref in bch2_backpointer_get_node()

bch2_btree_iter_peek_node() can return a NULL ptr (when the tree is
shorter than the search depth); handle this with an early return.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Fixes: https://lore.kernel.org/linux-bcachefs/5fc3c28b-c232-4ec7-b0ac-4ef220ddf976@moroto.mountain/T/
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/backpointers.c