diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c index f7672472fa82..2ca546af9191 100644 --- a/fs/ocfs2/extent_map.c +++ b/fs/ocfs2/extent_map.c @@ -415,6 +415,15 @@ static int ocfs2_get_clusters_nocache(struct inode *inode, tree_height = le16_to_cpu(el->l_tree_depth); if (tree_height > 0) { + if (tree_height > 256) { + ocfs2_error(inode->i_sb, + "Inode %lu has too big tree depth %d in leaf block %llu\n", + inode->i_ino, + tree_height, + (unsigned long long)di_bh->b_blocknr); + ret = -EROFS; + goto out; + } ret = ocfs2_find_leaf(INODE_CACHE(inode), el, v_cluster, &eb_bh); if (ret) {