diff --git a/fs/ext4/fsmap.c b/fs/ext4/fsmap.c index 4493ef0c715e..1aef127b0634 100644 --- a/fs/ext4/fsmap.c +++ b/fs/ext4/fsmap.c @@ -702,6 +702,12 @@ int ext4_getfsmap(struct super_block *sb, struct ext4_fsmap_head *head, if (handlers[i].gfd_dev > head->fmh_keys[0].fmr_device) memset(&dkeys[0], 0, sizeof(struct ext4_fsmap)); + /* + * Re-check the range after above limit operation and reject + * 1K fs on block 0 as fs should start block 1. */ + if (dkeys[0].fmr_physical ==0 && dkeys[1].fmr_physical == 0) + continue; + info.gfi_dev = handlers[i].gfd_dev; info.gfi_last = false; info.gfi_agno = -1;