summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-04-11 21:20:27 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2024-04-13 22:48:16 -0400
commitdc32c118ec6b1032693c489a0aa9e011f0acdb1a (patch)
treeee358c0fc2ba47388cbe86975a257a61c65d95b1 /fs/bcachefs
parent87cb0239c87f608fd48fb50f9f53f129dcfd73f4 (diff)
downloadlinux-stable-dc32c118ec6b1032693c489a0aa9e011f0acdb1a.tar.gz
linux-stable-dc32c118ec6b1032693c489a0aa9e011f0acdb1a.tar.bz2
linux-stable-dc32c118ec6b1032693c489a0aa9e011f0acdb1a.zip
bcachefs: fix unsafety in bch2_extent_ptr_to_text()
Need to check if we have a valid bucket before checking if ptr is stale Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs')
-rw-r--r--fs/bcachefs/extents.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c
index 0e3ca99fbd2d..36d12d2adb81 100644
--- a/fs/bcachefs/extents.c
+++ b/fs/bcachefs/extents.c
@@ -998,7 +998,9 @@ void bch2_extent_ptr_to_text(struct printbuf *out, struct bch_fs *c, const struc
prt_str(out, " cached");
if (ptr->unwritten)
prt_str(out, " unwritten");
- if (ca && ptr_stale(ca, ptr))
+ if (b >= ca->mi.first_bucket &&
+ b < ca->mi.nbuckets &&
+ ptr_stale(ca, ptr))
prt_printf(out, " stale");
}
}