Skip to content

Commit 4a8f8fa

Browse files
author
Kent Overstreet
committed
bcachefs: Add extra padding in bkey_make_mut_noupdate()
This fixes a kasan splat in propagate_key_to_snapshot_leaves() - varint_decode_fast() does reads (that it never uses) up to 7 bytes past the end of the integer. Signed-off-by: Kent Overstreet <[email protected]>
1 parent f890c85 commit 4a8f8fa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/bcachefs/btree_update.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ static inline struct bkey_i *__bch2_bkey_make_mut_noupdate(struct btree_trans *t
220220
if (type && k.k->type != type)
221221
return ERR_PTR(-ENOENT);
222222

223-
mut = bch2_trans_kmalloc_nomemzero(trans, bytes);
223+
/* extra padding for varint_decode_fast... */
224+
mut = bch2_trans_kmalloc_nomemzero(trans, bytes + 8);
224225
if (!IS_ERR(mut)) {
225226
bkey_reassemble(mut, k);
226227

0 commit comments

Comments
 (0)