mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-26 16:12:34 +00:00
btrfs-progs: check: prevent attempt to insert extent record with max_size==0
When this happens, we will trip a BUG_ON(end < start) in insert_state because in check_extent_refs, we use this max_size expecting it's not zero: set_extent_dirty(root->fs_info->excluded_extents, rec->start, rec->start + rec->max_size - 1); See https://bugzilla.redhat.com/show_bug.cgi?id=1435567 for an example where this scenario occurs. Signed-off-by: Christophe de Dinechin <dinechin@redhat.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
53a88b50ea
commit
05011bf0d4
@ -6030,6 +6030,7 @@ static int add_extent_rec_nolookup(struct cache_tree *extent_cache,
|
||||
struct extent_record *rec;
|
||||
int ret = 0;
|
||||
|
||||
BUG_ON(tmpl->max_size == 0);
|
||||
rec = malloc(sizeof(*rec));
|
||||
if (!rec)
|
||||
return -ENOMEM;
|
||||
|
Loading…
Reference in New Issue
Block a user