From: "Duane Griffin" <duaneg@dghda.com>
To: linux-kernel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org, Duane Griffin <duaneg@dghda.com>,
Evgeniy Dushistov <dushistov@mail.ru>
Subject: [PATCH] ufs: ensure fast symlinks are NUL-terminated
Date: Tue, 16 Dec 2008 15:51:58 +0000 [thread overview]
Message-ID: <1229442720-31056-7-git-send-email-duaneg@dghda.com> (raw)
In-Reply-To: <1229442720-31056-6-git-send-email-duaneg@dghda.com>
Ensure fast symlink targets are NUL-terminated, even if corrupted
on-disk.
Cc: Evgeniy Dushistov <dushistov@mail.ru>
Signed-off-by: Duane Griffin <duaneg@dghda.com>
---
fs/ufs/inode.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index 39f8778..aca4b58 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -36,6 +36,7 @@
#include <linux/mm.h>
#include <linux/smp_lock.h>
#include <linux/buffer_head.h>
+#include <linux/namei.h>
#include "ufs_fs.h"
#include "ufs.h"
@@ -606,9 +607,12 @@ static void ufs_set_inode_ops(struct inode *inode)
inode->i_fop = &ufs_dir_operations;
inode->i_mapping->a_ops = &ufs_aops;
} else if (S_ISLNK(inode->i_mode)) {
- if (!inode->i_blocks)
+ if (!inode->i_blocks) {
inode->i_op = &ufs_fast_symlink_inode_operations;
- else {
+ nd_terminate_link(UFS_I(inode)->i_u1.i_symlink,
+ inode->i_size,
+ sizeof(UFS_I(inode)->i_u1.i_symlink));
+ } else {
inode->i_op = &page_symlink_inode_operations;
inode->i_mapping->a_ops = &ufs_aops;
}
--
1.6.0.4
next prev parent reply other threads:[~2008-12-16 15:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-16 15:51 [PATCH 0/8, v3] ensure " 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 15:51 ` Duane Griffin [this message]
2008-12-16 15:51 ` [PATCH] sysv: " Duane Griffin
2008-12-16 15:52 ` [PATCH] freevxfs: " Duane Griffin
2008-12-16 19:40 ` [PATCH] ufs: " Evgeniy Dushistov
2008-12-16 23:18 ` Duane Griffin
2008-12-27 12:22 ` Evgeniy Dushistov
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
2008-12-16 17:03 ` [PATCH 0/8, v3] ensure symlinks are NUL-terminated Dave Kleikamp
2008-12-16 17:26 ` 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=1229442720-31056-7-git-send-email-duaneg@dghda.com \
--to=duaneg@dghda.com \
--cc=dushistov@mail.ru \
--cc=linux-fsdevel@vger.kernel.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
all inboxes | Powered by JetHome®