diff options
author | Steve French <sfrench@us.ibm.com> | 2009-02-03 15:19:23 +0000 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2009-02-03 15:19:23 +0000 |
commit | e1f81c8a417be466e85a38b61679aa6860ec7331 (patch) | |
tree | 749815f74bfad330e83560a10fd5da5fc4d8c765 /fs/ext3 | |
parent | 0e2bedaa394f74fa9f75ee937488c33d90039b5a (diff) | |
parent | b1792e367053968f2ddb48bc911d314143ce6242 (diff) | |
download | linux-e1f81c8a417be466e85a38b61679aa6860ec7331.tar.gz linux-e1f81c8a417be466e85a38b61679aa6860ec7331.tar.bz2 linux-e1f81c8a417be466e85a38b61679aa6860ec7331.zip |
Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/namei.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index 69a3d19ca9fd..4db4ffa1edad 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c @@ -1358,7 +1358,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, struct fake_dirent *fde; blocksize = dir->i_sb->s_blocksize; - dxtrace(printk("Creating index\n")); + dxtrace(printk(KERN_DEBUG "Creating index: inode %lu\n", dir->i_ino)); retval = ext3_journal_get_write_access(handle, bh); if (retval) { ext3_std_error(dir->i_sb, retval); @@ -1367,6 +1367,19 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, } root = (struct dx_root *) bh->b_data; + /* The 0th block becomes the root, move the dirents out */ + fde = &root->dotdot; + de = (struct ext3_dir_entry_2 *)((char *)fde + + ext3_rec_len_from_disk(fde->rec_len)); + if ((char *) de >= (((char *) root) + blocksize)) { + ext3_error(dir->i_sb, __func__, + "invalid rec_len for '..' in inode %lu", + dir->i_ino); + brelse(bh); + return -EIO; + } + len = ((char *) root) + blocksize - (char *) de; + bh2 = ext3_append (handle, dir, &block, &retval); if (!(bh2)) { brelse(bh); @@ -1375,11 +1388,6 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, EXT3_I(dir)->i_flags |= EXT3_INDEX_FL; data1 = bh2->b_data; - /* The 0th block becomes the root, move the dirents out */ - fde = &root->dotdot; - de = (struct ext3_dir_entry_2 *)((char *)fde + - ext3_rec_len_from_disk(fde->rec_len)); - len = ((char *) root) + blocksize - (char *) de; memcpy (data1, de, len); de = (struct ext3_dir_entry_2 *) data1; top = data1 + len; |