mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-09 14:50:19 +00:00
bcachefs: Don't allow bkey vals that are too big in extents btree
Make sure we don't overflow BKEY_PADDED keys Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
9146b8ee03
commit
66b095b008
@ -82,6 +82,11 @@ const char *__bch2_bkey_invalid(struct bch_fs *c, struct bkey_s_c k,
|
||||
if (k.k->u64s < BKEY_U64s)
|
||||
return "u64s too small";
|
||||
|
||||
if ((btree_node_type_is_extents(type) ||
|
||||
type == BKEY_TYPE_BTREE) &&
|
||||
bkey_val_u64s(k.k) > BKEY_EXTENT_VAL_U64s_MAX)
|
||||
return "value too big";
|
||||
|
||||
if (btree_node_type_is_extents(type)) {
|
||||
if ((k.k->size == 0) != bkey_deleted(k.k))
|
||||
return "bad size field";
|
||||
|
@ -1291,9 +1291,6 @@ void bch2_insert_fixup_extent(struct btree_trans *trans,
|
||||
|
||||
const char *bch2_extent_invalid(const struct bch_fs *c, struct bkey_s_c k)
|
||||
{
|
||||
if (bkey_val_u64s(k.k) > BKEY_EXTENT_VAL_U64s_MAX)
|
||||
return "value too big";
|
||||
|
||||
return bch2_bkey_ptrs_invalid(c, k);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user