lkml.org 
[lkml]   [2012]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[ 38/82] ext4: disallow hard-linked directory in ext4_lookup
    3.2-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Andreas Dilger <adilger@dilger.ca>

    commit 7e936b737211e6b54e34b71a827e56b872e958d8 upstream.

    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 <adilger@dilger.ca>
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    ---
    fs/ext4/namei.c | 6 ++++++
    1 file changed, 6 insertions(+)

    diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
    index a9fd5f4..daf8260 100644
    --- a/fs/ext4/namei.c
    +++ b/fs/ext4/namei.c
    @@ -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,



    \
     
     \ /
      Last update: 2012-06-08 08:21    [W:3.462 / U:0.156 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site