|
@@ -1330,6 +1330,12 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, stru
|
|
|
EXT4_ERROR_INODE(dir, "bad inode number: %u", ino);
|
|
|
return ERR_PTR(-EIO);
|
|
|
}
|
|
|
+ if (unlikely(ino == dir->i_ino)) {
|
|
|
+ EXT4_ERROR_INODE(dir, "'%.*s' linked to parent dir",
|
|
|
+ dentry->d_name.len,
|
|
|
+ dentry->d_name.name);
|
|
|
+ return ERR_PTR(-EIO);
|
|
|
+ }
|
|
|
inode = ext4_iget(dir->i_sb, ino);
|
|
|
if (inode == ERR_PTR(-ESTALE)) {
|
|
|
EXT4_ERROR_INODE(dir,
|