From: "Duane Griffin" <duaneg@dghda.com>
To: linux-kernel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>,
Duane Griffin <duaneg@dghda.com>,
Stephen Tweedie <sct@redhat.com>,
linux-ext4@vger.kernel.org
Subject: [PATCH, v5] ext3: ensure fast symlinks are NUL-terminated
Date: Fri, 19 Dec 2008 20:47:14 +0000 [thread overview]
Message-ID: <1229719638-6982-7-git-send-email-duaneg@dghda.com> (raw)
In-Reply-To: <1229719638-6982-6-git-send-email-duaneg@dghda.com>
Ensure fast symlink targets are NUL-terminated, even if corrupted
on-disk.
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Stephen Tweedie <sct@redhat.com>
Cc: linux-ext4@vger.kernel.org
Signed-off-by: Duane Griffin <duaneg@dghda.com>
---
Changes from v4: fixed off-by-one bug in maximum length, as pointed out by
Andreas Dilger.
fs/ext3/inode.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index f8424ad..c4bdccf 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -37,6 +37,7 @@
#include <linux/uio.h>
#include <linux/bio.h>
#include <linux/fiemap.h>
+#include <linux/namei.h>
#include "xattr.h"
#include "acl.h"
@@ -2817,9 +2818,11 @@ struct inode *ext3_iget(struct super_block *sb, unsigned long ino)
inode->i_op = &ext3_dir_inode_operations;
inode->i_fop = &ext3_dir_operations;
} else if (S_ISLNK(inode->i_mode)) {
- if (ext3_inode_is_fast_symlink(inode))
+ if (ext3_inode_is_fast_symlink(inode)) {
inode->i_op = &ext3_fast_symlink_inode_operations;
- else {
+ nd_terminate_link(ei->i_data, inode->i_size,
+ sizeof(ei->i_data) - 1);
+ } else {
inode->i_op = &ext3_symlink_inode_operations;
ext3_set_aops(inode);
}
--
1.6.0.4
next prev parent reply other threads:[~2008-12-19 20:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-19 20:47 [PATCH 0/10] make link target handling more robust Duane Griffin
2008-12-19 20:47 ` [PATCH, v5] 9p: don't print IS_ERR strings Duane Griffin
2008-12-19 20:47 ` [PATCH, v5] eCryptfs: check readlink result was not an error before using it Duane Griffin
2008-12-19 20:47 ` [PATCH, v5] vfs: introduce helper function to safely NUL-terminate symlinks Duane Griffin
2008-12-19 20:47 ` [PATCH, v5] vfs: ensure page symlinks are NUL-terminated Duane Griffin
2008-12-19 20:47 ` [PATCH, v5] ext2: ensure fast " Duane Griffin
2008-12-19 20:47 ` Duane Griffin [this message]
2008-12-19 20:47 ` [PATCH, v5] ext4: " Duane Griffin
2008-12-19 20:47 ` [PATCH, v5] sysv: " Duane Griffin
2008-12-19 20:47 ` [PATCH, v5] freevxfs: " Duane Griffin
2008-12-19 20:47 ` [PATCH, v5] befs: " Duane Griffin
2008-12-22 19:58 ` [PATCH, v5] eCryptfs: check readlink result was not an error before using it Tyler Hicks
2008-12-22 20:06 ` Dustin Kirkland
2008-12-19 22:07 ` [PATCH, v5] 9p: don't print IS_ERR strings Eric Van Hensbergen
2008-12-19 22:22 ` Duane Griffin
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=1229719638-6982-7-git-send-email-duaneg@dghda.com \
--to=duaneg@dghda.com \
--cc=akpm@linux-foundation.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sct@redhat.com \
--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).