summaryrefslogtreecommitdiff
path: root/chunk-recover.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-10-03 15:49:45 +0200
committerDavid Sterba <dsterba@suse.com>2016-10-05 12:39:01 +0200
commit61d5425fd3a089c6ffbad62b145f1a06c21ff860 (patch)
tree1b975c78dd59fcff9d366229b9cb881b1ca54a46 /chunk-recover.c
parent9adce1abe405eed3f56b753ceb9a6ad6fb5f7ce0 (diff)
btrfs-progs: chunk-recover: handle duplicate cache entries
Triggered by fuzzed image bko-155621-bad-block-group-offset.raw . Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'chunk-recover.c')
-rw-r--r--chunk-recover.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/chunk-recover.c b/chunk-recover.c
index d1e6c386..5bde5b13 100644
--- a/chunk-recover.c
+++ b/chunk-recover.c
@@ -2250,6 +2250,13 @@ static int btrfs_recover_chunks(struct recover_control *rc)
chunk->sub_stripes = calc_sub_nstripes(bg->flags);
ret = insert_cache_extent(&rc->chunk, &chunk->cache);
+ if (ret == -EEXIST) {
+ error("duplicate entry in cache start %llu size %llu",
+ (unsigned long long)chunk->cache.start,
+ (unsigned long long)chunk->cache.size);
+ free(chunk);
+ return ret;
+ }
BUG_ON(ret);
list_del_init(&bg->list);