mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
ext4: disallow hard-linked directory in ext4_lookup
A hard-linked directory to its parent can cause the VFS to deadlock, and is a sign of a corrupted file system. So detect this case in ext4_lookup(), before the rmdir() lockup scenario can take place. Signed-off-by: Andreas Dilger <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: [email protected]
This commit is contained in:
parent
967ac8af44
commit
7e936b7372
1 changed files with 6 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue