Re: [PATCH v3] bcachefs: Fix NULL ptr dereference in btree_node_iter_and_journal_peek
From: Kent Overstreet
Date: Sun Oct 27 2024 - 16:19:37 EST
On Sun, Oct 27, 2024 at 07:46:52PM +0000, Piotr Zalewski wrote:
> Add NULL check for key returned from bch2_btree_and_journal_iter_peek in
> btree_node_iter_and_journal_peek to avoid NULL ptr dereference in
> bch2_bkey_buf_reassemble.
>
> When key returned from bch2_btree_and_journal_iter_peek is NULL it means
> that btree topology needs repair. Print topology error message with
> position at which node wasn't found, its parent node information and
> btree_id with level.
>
> Return error code returned by bch2_topology_error to ensure that topology
> error is handled properly by recovery.
>
> Reported-by: syzbot+005ef9aa519f30d97657@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes: https://syzkaller.appspot.com/bug?extid=005ef9aa519f30d97657
> Fixes: 5222a4607cd8 ("bcachefs: BTREE_ITER_WITH_JOURNAL")
> Suggested-by: Alan Huang <mmpgouride@xxxxxxxxx>
> Suggested-by: Kent Overstreet <kent.overstreet@xxxxxxxxx>
> Signed-off-by: Piotr Zalewski <pZ010001011111@xxxxxxxxx>
Thanks - applied.