ext4: fix buffer leak in __ext4_read_dirblock() on error path
[sfrench/cifs-2.6.git] / fs / ext4 / namei.c
index d388cce72db201c48c22f4247a0f902e9b79ae1c..6a6b90363ef1b2344c053d0a751a4c8a5989cde2 100644 (file)
@@ -126,6 +126,7 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode,
        if (!is_dx_block && type == INDEX) {
                ext4_error_inode(inode, func, line, block,
                       "directory leaf block found instead of index block");
        if (!is_dx_block && type == INDEX) {
                ext4_error_inode(inode, func, line, block,
                       "directory leaf block found instead of index block");
+               brelse(bh);
                return ERR_PTR(-EFSCORRUPTED);
        }
        if (!ext4_has_metadata_csum(inode->i_sb) ||
                return ERR_PTR(-EFSCORRUPTED);
        }
        if (!ext4_has_metadata_csum(inode->i_sb) ||