lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKEZqKJhZNoF-29ymEmAjiYfVn64q5mHrMY9sC2NZ=EDqTHjeA@mail.gmail.com>
Date:   Sun, 27 May 2018 00:33:40 +0800
From:   Lei Chen <losemyheaven@...il.com>
To:     linux-fsdevel@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, viro@...iv.linux.org.uk
Subject: Why does d_splice_alias need to check IS_ROOT?

Hello list,

I'm insteresting in how hard link and denry lookup work and their
implementation.

I know that this interface tries to connect an inode to a dentry, but
why does it need
to check whether the inode alias IS_ROOT if the inode represents a directory?
And the code process in different way according to check result.  What
occasions
are they used for?

struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
{
    if (S_ISDIR(inode->i_mode)) {
        struct dentry *new = __d_find_any_alias(inode);
        if (unlikely(new)) {
            if (unlikely(d_ancestor(new, dentry))) {
                /*the code here is to forbidden ancestor hard link*/
            } else if (!IS_ROOT(new)) {
                __d_unalias(inode, dentry, new);
            } else {
                __d_move(new, dentry, false);
            }

        }


    }
}

Thanks in advance.

Regards,
Larry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ