aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/namei.c6
-rw-r--r--include/linux/fcntl.h1
2 files changed, 5 insertions, 2 deletions
diff --git a/fs/namei.c b/fs/namei.c
index bb4a3e40e432..c784e8bb57a3 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2243,14 +2243,16 @@ asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
2243 int error; 2243 int error;
2244 char * to; 2244 char * to;
2245 2245
2246 if (flags != 0) 2246 if ((flags & ~AT_SYMLINK_FOLLOW) != 0)
2247 return -EINVAL; 2247 return -EINVAL;
2248 2248
2249 to = getname(newname); 2249 to = getname(newname);
2250 if (IS_ERR(to)) 2250 if (IS_ERR(to))
2251 return PTR_ERR(to); 2251 return PTR_ERR(to);
2252 2252
2253 error = __user_walk_fd(olddfd, oldname, 0, &old_nd); 2253 error = __user_walk_fd(olddfd, oldname,
2254 flags & AT_SYMLINK_FOLLOW ? LOOKUP_FOLLOW : 0,
2255 &old_nd);
2254 if (error) 2256 if (error)
2255 goto exit; 2257 goto exit;
2256 error = do_path_lookup(newdfd, to, LOOKUP_PARENT, &nd); 2258 error = do_path_lookup(newdfd, to, LOOKUP_PARENT, &nd);
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index c52a63755fdd..996f5611cd59 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -29,6 +29,7 @@
29#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */ 29#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
30#define AT_REMOVEDIR 0x200 /* Remove directory instead of 30#define AT_REMOVEDIR 0x200 /* Remove directory instead of
31 unlinking file. */ 31 unlinking file. */
32#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
32 33
33#ifdef __KERNEL__ 34#ifdef __KERNEL__
34 35