diff options
-rw-r--r-- | fs/namei.c | 3 | ||||
-rw-r--r-- | include/linux/namei.h | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c index 7def6aa9a53d..b638c9cd6d4c 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1056,6 +1056,9 @@ const char *get_link(struct nameidata *nd) int error; const char *res; + if (unlikely(nd->flags & LOOKUP_NO_SYMLINKS)) + return ERR_PTR(-ELOOP); + if (!(nd->flags & LOOKUP_RCU)) { touch_atime(&last->link); cond_resched(); diff --git a/include/linux/namei.h b/include/linux/namei.h index b2479cc119c6..c42a1924ad67 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h @@ -39,6 +39,9 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; #define LOOKUP_ROOT 0x2000 #define LOOKUP_ROOT_GRABBED 0x0008 +/* Scoping flags for lookup. */ +#define LOOKUP_NO_SYMLINKS 0x010000 /* No symlink crossing. */ + extern int path_pts(struct path *path); extern int user_path_at_empty(int, const char __user *, unsigned, struct path *, int *empty); |