Re: [PATCH] JFS: ensure link targets are NULL-terminated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2008/12/11 Dave Kleikamp <shaggy@xxxxxxxxxxxxxxxxxx>:
> Thanks.
>
> I came up with an alternate patch that I like slightly better.  This one
> null-terminates the string when the inode is read rather than every time
> the link is followed, and at the proper place (i_size).  It's not a big
> deal, since the symlink will be corrupted either way.  What do you think
> of this patch?
>
> Signed-off-by: Dave Kleikamp <shaggy@xxxxxxxxxxxxxxxxxx>
>
> diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
> index 2103397..b00ee9f 100644
> --- a/fs/jfs/inode.c
> +++ b/fs/jfs/inode.c
> @@ -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);

Yes, I prefer your version too :)

I'll rework the other patches similarly, where appropriate. Thanks!

Cheers,
Duane.

-- 
"I never could learn to drink that blood and call it wine" - Bob Dylan
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux