Skip to content

Commit dc32c11

Browse files
author
Kent Overstreet
committed
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>
1 parent 87cb023 commit dc32c11

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/bcachefs/extents.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,9 @@ void bch2_extent_ptr_to_text(struct printbuf *out, struct bch_fs *c, const struc
998998
prt_str(out, " cached");
999999
if (ptr->unwritten)
10001000
prt_str(out, " unwritten");
1001-
if (ca && ptr_stale(ca, ptr))
1001+
if (b >= ca->mi.first_bucket &&
1002+
b < ca->mi.nbuckets &&
1003+
ptr_stale(ca, ptr))
10021004
prt_printf(out, " stale");
10031005
}
10041006
}

0 commit comments

Comments
 (0)