[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1229442720-31056-7-git-send-email-duaneg@dghda.com>
Date: Tue, 16 Dec 2008 15:51:58 +0000
From: "Duane Griffin" <duaneg@...da.com>
To: linux-kernel@...r.kernel.org
Cc: linux-fsdevel@...r.kernel.org, Duane Griffin <duaneg@...da.com>,
Evgeniy Dushistov <dushistov@...l.ru>
Subject: [PATCH] ufs: ensure fast symlinks are NUL-terminated
Ensure fast symlink targets are NUL-terminated, even if corrupted
on-disk.
Cc: Evgeniy Dushistov <dushistov@...l.ru>
Signed-off-by: Duane Griffin <duaneg@...da.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists