]> www.infradead.org Git - nvme.git/commitdiff
bcachefs: Fix null ptr deref in invalidate_one_bucket()
authorKent Overstreet <kent.overstreet@linux.dev>
Wed, 2 Apr 2025 16:48:23 +0000 (12:48 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 3 Apr 2025 16:11:43 +0000 (12:11 -0400)
bch2_backpointer_get_key() returns bkey_s_c_null when the target isn't
found.

backpointer_get_key() flags the error, so there's nothing else to do
here - just skip it and move on.

Link: https://github.com/koverstreet/bcachefs/issues/847
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/alloc_background.c

index 6b6c2521c11fad5d0bdf99713fd362edc0503e27..94ea9e49aec451591096fed74af07afc71bacf4b 100644 (file)
@@ -2084,6 +2084,9 @@ static int invalidate_one_bp(struct btree_trans *trans,
        if (ret)
                return ret;
 
+       if (!extent_k.k)
+               return 0;
+
        struct bkey_i *n =
                bch2_bkey_make_mut(trans, &extent_iter, &extent_k,
                                   BTREE_UPDATE_internal_snapshot_node);