mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-06 05:06:29 +00:00
bcachefs: Don't overflow stack in bch2_extent_merge_inline()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
5884fddfe7
commit
1ae9733456
@ -41,10 +41,7 @@ struct bkey_s {
|
||||
|
||||
#define bkey_next(_k) vstruct_next(_k)
|
||||
|
||||
static inline unsigned bkey_val_u64s(const struct bkey *k)
|
||||
{
|
||||
return k->u64s - BKEY_U64s;
|
||||
}
|
||||
#define bkey_val_u64s(_k) ((_k)->u64s - BKEY_U64s)
|
||||
|
||||
static inline size_t bkey_val_bytes(const struct bkey *k)
|
||||
{
|
||||
|
@ -1651,6 +1651,10 @@ static bool bch2_extent_merge_inline(struct bch_fs *c,
|
||||
|
||||
EBUG_ON(bkey_written(b, m));
|
||||
|
||||
if (bkey_val_u64s(l) > BKEY_EXTENT_VAL_U64s_MAX ||
|
||||
bkey_val_u64s(r) > BKEY_EXTENT_VAL_U64s_MAX)
|
||||
return BCH_MERGE_NOMERGE;
|
||||
|
||||
/*
|
||||
* We need to save copies of both l and r, because we might get a
|
||||
* partial merge (which modifies both) and then fails to repack
|
||||
|
Loading…
Reference in New Issue
Block a user