Merge tag 'gcc-plugins-v4.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / fs / namei.c
index 8bacc39..ddb6a7c 100644 (file)
@@ -524,7 +524,7 @@ struct nameidata {
        struct inode    *link_inode;
        unsigned        root_seq;
        int             dfd;
-};
+} __randomize_layout;
 
 static void set_nameidata(struct nameidata *p, int dfd, struct filename *name)
 {
@@ -1008,7 +1008,7 @@ static int may_linkat(struct path *link)
        /* Source inode owner (or CAP_FOWNER) can hardlink all they like,
         * otherwise, it must be a safe source.
         */
-       if (inode_owner_or_capable(inode) || safe_hardlink_source(inode))
+       if (safe_hardlink_source(inode) || inode_owner_or_capable(inode))
                return 0;
 
        audit_log_link_denied("linkat", link);
@@ -3400,7 +3400,6 @@ out:
 
 struct dentry *vfs_tmpfile(struct dentry *dentry, umode_t mode, int open_flag)
 {
-       static const struct qstr name = QSTR_INIT("/", 1);
        struct dentry *child = NULL;
        struct inode *dir = dentry->d_inode;
        struct inode *inode;
@@ -3414,7 +3413,7 @@ struct dentry *vfs_tmpfile(struct dentry *dentry, umode_t mode, int open_flag)
        if (!dir->i_op->tmpfile)
                goto out_err;
        error = -ENOMEM;
-       child = d_alloc(dentry, &name);
+       child = d_alloc(dentry, &slash_name);
        if (unlikely(!child))
                goto out_err;
        error = dir->i_op->tmpfile(dir, child, mode);
@@ -4363,11 +4362,11 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 {
        int error;
        bool is_dir = d_is_dir(old_dentry);
-       const unsigned char *old_name;
        struct inode *source = old_dentry->d_inode;
        struct inode *target = new_dentry->d_inode;
        bool new_is_dir = false;
        unsigned max_links = new_dir->i_sb->s_max_links;
+       struct name_snapshot old_name;
 
        if (source == target)
                return 0;
@@ -4414,7 +4413,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
        if (error)
                return error;
 
-       old_name = fsnotify_oldname_init(old_dentry->d_name.name);
+       take_dentry_name_snapshot(&old_name, old_dentry);
        dget(new_dentry);
        if (!is_dir || (flags & RENAME_EXCHANGE))
                lock_two_nondirectories(source, target);
@@ -4469,14 +4468,14 @@ out:
                inode_unlock(target);
        dput(new_dentry);
        if (!error) {
-               fsnotify_move(old_dir, new_dir, old_name, is_dir,
+               fsnotify_move(old_dir, new_dir, old_name.name, is_dir,
                              !(flags & RENAME_EXCHANGE) ? target : NULL, old_dentry);
                if (flags & RENAME_EXCHANGE) {
                        fsnotify_move(new_dir, old_dir, old_dentry->d_name.name,
                                      new_is_dir, NULL, new_dentry);
                }
        }
-       fsnotify_oldname_free(old_name);
+       release_dentry_name_snapshot(&old_name);
 
        return error;
 }