mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-17 10:46:33 +00:00
bcachefs: Fix a slab-out-of-bounds
In __bch2_alloc_to_v4_mut(), we overrun the buffer we allocate if the alloc key had backpointers stored in it (which we no longer support). Fix this with a max() call. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
853b7393c2
commit
615fccada5
@ -479,7 +479,7 @@ __bch2_alloc_to_v4_mut(struct btree_trans *trans, struct bkey_s_c k)
|
||||
{
|
||||
struct bkey_i_alloc_v4 *ret;
|
||||
|
||||
ret = bch2_trans_kmalloc(trans, sizeof(struct bkey_i_alloc_v4));
|
||||
ret = bch2_trans_kmalloc(trans, max(bkey_bytes(k.k), sizeof(struct bkey_i_alloc_v4)));
|
||||
if (IS_ERR(ret))
|
||||
return ret;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user