From: "Duane Griffin" <duaneg@dghda.com>
To: linux-kernel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org, Duane Griffin <duaneg@dghda.com>,
Al Viro <viro@zeniv.linux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] vfs: introduce helper function to safely NUL-terminate symlinks
Date: Tue, 16 Dec 2008 16:53:39 +0000 [thread overview]
Message-ID: <1229446419-8680-2-git-send-email-duaneg@dghda.com> (raw)
In-Reply-To: <1229446419-8680-1-git-send-email-duaneg@dghda.com>
A number of filesystems were potentially triggering kernel bugs due to
corrupted symlink names on disk. This helper helps safely terminate the
names.
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Duane Griffin <duaneg@dghda.com>
---
include/linux/namei.h | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 99eb803..231ce28 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -94,4 +94,9 @@ static inline char *nd_get_link(struct nameidata *nd)
return nd->saved_names[nd->depth];
}
+static inline void nd_terminate_link(void *name, size_t len, size_t maxlen)
+{
+ ((char *) name)[min(len, maxlen)] = '\0';
+}
+
#endif /* _LINUX_NAMEI_H */
--
1.6.0.4
next prev parent reply other threads:[~2008-12-16 16:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-16 16:53 [PATCH, v4] vfs: introduce helper function to safely NUL-terminate symlinks Duane Griffin
2008-12-16 16:53 ` Duane Griffin [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-12-16 15:51 [PATCH 0/8, v3] ensure symlinks are NUL-terminated Duane Griffin
2008-12-16 15:51 ` [PATCH] vfs: introduce helper function to safely NUL-terminate symlinks Duane Griffin
2008-12-16 15:51 ` [PATCH] vfs: ensure page symlinks are NUL-terminated Duane Griffin
2008-12-16 15:51 ` [PATCH] ext2: ensure fast " Duane Griffin
2008-12-16 15:51 ` [PATCH] ext3: " Duane Griffin
2008-12-16 15:51 ` [PATCH] ext4: " Duane Griffin
2008-12-16 23:46 ` [PATCH] vfs: introduce helper function to safely NUL-terminate symlinks Andreas Dilger
2008-12-17 0:26 ` Duane Griffin
2008-12-19 15:03 ` Duane Griffin
2008-12-19 19:28 ` Andrew Morton
2008-12-19 19:43 ` Al Viro
2008-12-16 16:38 ` Al Viro
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=1229446419-8680-2-git-send-email-duaneg@dghda.com \
--to=duaneg@dghda.com \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).