*     path-walking is complete.
  */
 static struct filename *
-user_path_parent(int dfd, const char __user *path, struct nameidata *nd)
+user_path_parent(int dfd, const char __user *path, struct nameidata *nd,
+                unsigned int flags)
 {
        struct filename *s = getname(path);
        int error;
 
+       /* only LOOKUP_REVAL is allowed in extra flags */
+       flags &= LOOKUP_REVAL;
+
        if (IS_ERR(s))
                return s;
 
-       error = filename_lookup(dfd, s, LOOKUP_PARENT, nd);
+       error = filename_lookup(dfd, s, flags | LOOKUP_PARENT, nd);
        if (error) {
                putname(s);
                return ERR_PTR(error);
        struct dentry *dentry;
        struct nameidata nd;
 
-       name = user_path_parent(dfd, pathname, &nd);
+       name = user_path_parent(dfd, pathname, &nd, 0);
        if (IS_ERR(name))
                return PTR_ERR(name);
 
        struct nameidata nd;
        struct inode *inode = NULL;
 
-       name = user_path_parent(dfd, pathname, &nd);
+       name = user_path_parent(dfd, pathname, &nd, 0);
        if (IS_ERR(name))
                return PTR_ERR(name);
 
        struct filename *to;
        int error;
 
-       from = user_path_parent(olddfd, oldname, &oldnd);
+       from = user_path_parent(olddfd, oldname, &oldnd, 0);
        if (IS_ERR(from)) {
                error = PTR_ERR(from);
                goto exit;
        }
 
-       to = user_path_parent(newdfd, newname, &newnd);
+       to = user_path_parent(newdfd, newname, &newnd, 0);
        if (IS_ERR(to)) {
                error = PTR_ERR(to);
                goto exit1;