summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/md/bcache/btree_io.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/md/bcache/btree_io.c b/drivers/md/bcache/btree_io.c
index 34631d043645..57c820456b4f 100644
--- a/drivers/md/bcache/btree_io.c
+++ b/drivers/md/bcache/btree_io.c
@@ -228,6 +228,16 @@ static const char *validate_bset(struct cache_set *c, struct btree *b,
break;
}
+ if (k->format > KEY_FORMAT_CURRENT) {
+ btree_node_error(b, c, ptr,
+ "invalid bkey format %u", k->format);
+
+ i->u64s = cpu_to_le16(le16_to_cpu(i->u64s) - k->u64s);
+ memmove(k, bkey_next(k),
+ (void *) bset_bkey_last(i) - (void *) k);
+ continue;
+ }
+
if (BSET_BIG_ENDIAN(i) != CPU_BIG_ENDIAN)
bch_bkey_swab(btree_node_type(b), &b->keys.format, k);