summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-04-02 12:48:23 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2025-04-03 12:11:43 -0400
commit39ebd74864f5c4f7d44f1fe026c71a270631186b (patch)
treea63472ea0eef21e50c58773e9f52dfe5b0c8bb8d /fs
parent83d539b1b04705f972b53b4669fb587c54def0db (diff)
downloadlinux-39ebd74864f5c4f7d44f1fe026c71a270631186b.tar.gz
linux-39ebd74864f5c4f7d44f1fe026c71a270631186b.tar.bz2
linux-39ebd74864f5c4f7d44f1fe026c71a270631186b.zip
bcachefs: Fix null ptr deref in invalidate_one_bucket()
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/alloc_background.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 6b6c2521c11f..94ea9e49aec4 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -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);