From: Andi Kleen <andi@firstfloor.org>
To: linux-kernel@vger.kernel.org
Cc: libc-alpha@sourceware.org, Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 1/5] VFS: Make symlink nesting limit a define
Date: Fri, 13 May 2011 16:24:15 -0700 [thread overview]
Message-ID: <1305329059-2017-2-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1305329059-2017-1-git-send-email-andi@firstfloor.org>
From: Andi Kleen <ak@linux.intel.com>
Use a SYMLOOP_MAX define for the total symlink nesting limit instead
of a hardcoded 40. No behaviour change.
Used in a followon patch
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
fs/namei.c | 6 +++---
include/linux/limits.h | 1 +
include/linux/namei.h | 1 +
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index 54fc993..9d0a92e 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -763,7 +763,7 @@ follow_link(struct path *link, struct nameidata *nd, void **p)
if (link->mnt == nd->path.mnt)
mntget(link->mnt);
- if (unlikely(current->total_link_count >= 40)) {
+ if (unlikely(current->total_link_count >= SYMLOOP_MAX)) {
*p = ERR_PTR(-ELOOP); /* no ->put_link(), please */
path_put(&nd->path);
return -ELOOP;
@@ -871,7 +871,7 @@ static int follow_automount(struct path *path, unsigned flags,
return -EISDIR;
current->total_link_count++;
- if (current->total_link_count >= 40)
+ if (current->total_link_count >= SYMLOOP_MAX)
return -ELOOP;
mnt = path->dentry->d_op->d_automount(path);
@@ -1369,7 +1369,7 @@ static inline int walk_component(struct nameidata *nd, struct path *path,
/*
* This limits recursive symlink follows to 8, while
- * limiting consecutive symlinks to 40.
+ * limiting consecutive symlinks to 40 (SYMLOOP_MAX)
*
* Without that kind of total limit, nasty chains of consecutive
* symlinks can cause almost arbitrarily long lookups.
diff --git a/include/linux/limits.h b/include/linux/limits.h
index 2d0f941..2f39657 100644
--- a/include/linux/limits.h
+++ b/include/linux/limits.h
@@ -14,6 +14,7 @@
#define XATTR_NAME_MAX 255 /* # chars in an extended attribute name */
#define XATTR_SIZE_MAX 65536 /* size of an extended attribute value (64k) */
#define XATTR_LIST_MAX 65536 /* size of extended attribute namelist (64k) */
+#define SYMLOOP_MAX 40 /* max number of total symlink nests */
#define RTSIG_MAX 32
diff --git a/include/linux/namei.h b/include/linux/namei.h
index eba45ea..403e39c 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -4,6 +4,7 @@
#include <linux/dcache.h>
#include <linux/linkage.h>
#include <linux/path.h>
+#include <linux/limits.h>
struct vfsmount;
--
1.7.4.4
next prev parent reply other threads:[~2011-05-13 23:24 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-13 23:24 Add a sysconf syscall Andi Kleen
2011-05-13 23:24 ` Andi Kleen [this message]
2011-05-13 23:24 ` [PATCH 2/5] Move max_threads variable declaration into include file Andi Kleen
2011-05-13 23:24 ` [PATCH 3/5] EXEC: Use define for stack to argument size limit Andi Kleen
2011-05-13 23:24 ` [PATCH 4/5] Add a sysconf syscall Andi Kleen
2011-05-14 6:57 ` Ingo Molnar
2011-05-14 16:34 ` Andi Kleen
2011-05-16 13:36 ` Ingo Molnar
2011-05-17 11:25 ` Ingo Molnar
2011-05-16 15:51 ` Andy Lutomirski
2011-05-16 16:08 ` Andi Kleen
2011-05-16 17:06 ` Andrew Lutomirski
[not found] ` <OFCC4C610A.F152D00D-ON86257892.005E11F4-86257892.005E22BA@us.ibm.com>
[not found] ` <4DD15E9B.2090809@linux.intel.com>
2011-05-17 10:59 ` Ingo Molnar
2011-05-16 15:42 ` Denys Vlasenko
2011-05-16 16:01 ` Andi Kleen
[not found] ` <OF30360F87.5C6D6DCF-ON86257892.005D7E68-86257892.005E0059@us.ibm.com>
2011-05-16 17:39 ` Andi Kleen
[not found] ` <OFD2EE69FB.301A458A-ON86257892.00631BE8-86257892.006A93AF@us.ibm.com>
2011-05-16 20:51 ` Andi Kleen
2011-05-17 12:33 ` Denys Vlasenko
2011-05-13 23:24 ` [PATCH 5/5] Hook up sysconf syscall for all architectures Andi Kleen
2011-05-14 1:21 ` David Miller
2011-05-14 2:51 ` Andi Kleen
2011-05-14 2:23 ` Mike Frysinger
2011-05-24 1:46 ` Mike Frysinger
2011-05-26 18:04 ` Mike Frysinger
2011-05-26 18:45 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1305329059-2017-2-git-send-email-andi@firstfloor.org \
--to=andi@firstfloor.org \
--cc=ak@linux.intel.com \
--cc=libc-alpha@sourceware.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome