diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 8c9c4825f984..ff632f1337b7 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c @@ -865,6 +865,13 @@ static int ocfs2_dx_dir_lookup(struct inode *inode, u64 blkno; u32 name_hash = hinfo->major_hash; + if (le16_to_cpu(el->l_count) != + ocfs2_extent_recs_per_dx_root(inode->i_sb)) { + ret = -EFSCORRUPTED; + mlog_errno(ret); + goto out; + } + ret = ocfs2_dx_dir_lookup_rec(inode, el, name_hash, &cpos, &blkno, &clen); if (ret) {