Skip to content

Commit

Permalink
jfs: ensure symlinks are NUL-terminated
Browse files Browse the repository at this point in the history
This is an alternate fix for a bug reported and fixed by Duane Griffin.

Signed-off-by: Dave Kleikamp <[email protected]>
Reported-by: Duane Griffin <[email protected]>
  • Loading branch information
Dave Kleikamp committed Dec 16, 2008
1 parent a3dd154 commit d69e83d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fs/jfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,14 @@ struct inode *jfs_iget(struct super_block *sb, unsigned long ino)
if (inode->i_size >= IDATASIZE) {
inode->i_op = &page_symlink_inode_operations;
inode->i_mapping->a_ops = &jfs_aops;
} else
} else {
inode->i_op = &jfs_symlink_inode_operations;
/*
* The inline data should be null-terminated, but
* don't let on-disk corruption crash the kernel
*/
JFS_IP(inode)->i_inline[inode->i_size] = '\0';
}
} else {
inode->i_op = &jfs_file_inode_operations;
init_special_inode(inode, inode->i_mode, inode->i_rdev);
Expand Down

0 comments on commit d69e83d

Please sign in to comment.