Commit e812cf38 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Check for key size > offset

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 91052b9d
...@@ -90,6 +90,9 @@ const char *__bch2_bkey_invalid(struct bch_fs *c, struct bkey_s_c k, ...@@ -90,6 +90,9 @@ const char *__bch2_bkey_invalid(struct bch_fs *c, struct bkey_s_c k,
if (btree_node_type_is_extents(type)) { if (btree_node_type_is_extents(type)) {
if ((k.k->size == 0) != bkey_deleted(k.k)) if ((k.k->size == 0) != bkey_deleted(k.k))
return "bad size field"; return "bad size field";
if (k.k->size > k.k->p.offset)
return "size greater than offset";
} else { } else {
if (k.k->size) if (k.k->size)
return "nonzero size field"; return "nonzero size field";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment