diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 494994d9a332b0f2f71544accc64d4f77a7e1183..f66c3fae90584b3f300e27e0b508934ae746de67 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -388,6 +388,17 @@ static int ext4_xattr_inode_iget(struct inode *parent, unsigned long ea_ino, struct inode *inode; int err; + /* + * We have to check for this corruption early as otherwise + * iget_locked() could wait indefinitely for the state of our + * parent inode. + */ + if (parent->i_ino == ea_ino) { + ext4_error(parent->i_sb, + "Parent and EA inode have the same ino %lu", ea_ino); + return -EFSCORRUPTED; + } + inode = ext4_iget(parent->i_sb, ea_ino, EXT4_IGET_NORMAL); if (IS_ERR(inode)) { err = PTR_ERR(inode);