mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-17 02:36:21 +00:00
bcachefs: Fix a memory splat
In __bch2_sb_field_resize, when a field's old a new size was 0, we were doing an invalid write just past the end of the superblock. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
22502ac23a
commit
187c71f6ab
@ -54,7 +54,9 @@ static struct bch_sb_field *__bch2_sb_field_resize(struct bch_sb_handle *sb,
|
||||
BUG_ON(get_order(__vstruct_bytes(struct bch_sb, sb_u64s)) >
|
||||
sb->page_order);
|
||||
|
||||
if (!f) {
|
||||
if (!f && !u64s) {
|
||||
/* nothing to do: */
|
||||
} else if (!f) {
|
||||
f = vstruct_last(sb->sb);
|
||||
memset(f, 0, sizeof(u64) * u64s);
|
||||
f->u64s = cpu_to_le32(u64s);
|
||||
|
Loading…
x
Reference in New Issue
Block a user