aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDuane Griffin <duaneg@dghda.com>2008-12-19 15:47:13 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2008-12-31 18:07:39 -0500
commit8d6d0c4da2dbbe0a69fea3692146af39f139f8b4 (patch)
tree306ab9a840c9e37c1cdc5d56a8f376fec85fd21d /fs
parentebd09abbd9699f328165aee50a070403fbf55a37 (diff)
ext2: ensure fast symlinks are NUL-terminated
Ensure fast symlink targets are NUL-terminated, even if corrupted on-disk. Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Duane Griffin <duaneg@dghda.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext2/inode.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 7658b33e2653..02b39a5deb74 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -32,6 +32,7 @@
32#include <linux/buffer_head.h> 32#include <linux/buffer_head.h>
33#include <linux/mpage.h> 33#include <linux/mpage.h>
34#include <linux/fiemap.h> 34#include <linux/fiemap.h>
35#include <linux/namei.h>
35#include "ext2.h" 36#include "ext2.h"
36#include "acl.h" 37#include "acl.h"
37#include "xip.h" 38#include "xip.h"
@@ -1286,9 +1287,11 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
1286 else 1287 else
1287 inode->i_mapping->a_ops = &ext2_aops; 1288 inode->i_mapping->a_ops = &ext2_aops;
1288 } else if (S_ISLNK(inode->i_mode)) { 1289 } else if (S_ISLNK(inode->i_mode)) {
1289 if (ext2_inode_is_fast_symlink(inode)) 1290 if (ext2_inode_is_fast_symlink(inode)) {
1290 inode->i_op = &ext2_fast_symlink_inode_operations; 1291 inode->i_op = &ext2_fast_symlink_inode_operations;
1291 else { 1292 nd_terminate_link(ei->i_data, inode->i_size,
1293 sizeof(ei->i_data) - 1);
1294 } else {
1292 inode->i_op = &ext2_symlink_inode_operations; 1295 inode->i_op = &ext2_symlink_inode_operations;
1293 if (test_opt(inode->i_sb, NOBH)) 1296 if (test_opt(inode->i_sb, NOBH))
1294 inode->i_mapping->a_ops = &ext2_nobh_aops; 1297 inode->i_mapping->a_ops = &ext2_nobh_aops;