Re: [PATCH] Fix minixfs size check

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

 



On Sun 13-05-12 15:48:55, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> minixfs file size check is buggy and it doesn't allow creating a block which
> can't be fully filled
  Umm, I'm not really minix expert but who'd set s_max_size to something
which is not a multiple of block size? This looks rather artifical problem
to me...

								Honza
> 
> Signed-off-by: Vladimir Serbinenko <phcoder@xxxxxxxxx>
> 
> diff --git a/fs/minix/itree_v1.c b/fs/minix/itree_v1.c
> index 282e15a..4f8f8b2 100644
> --- a/fs/minix/itree_v1.c
> +++ b/fs/minix/itree_v1.c
> @@ -29,7 +29,8 @@ static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
>  	if (block < 0) {
>  		printk("MINIX-fs: block_to_path: block %ld < 0 on dev %s\n",
>  			block, bdevname(inode->i_sb->s_bdev, b));
> -	} else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) {
> +	} else if ((u64) block * (u64) BLOCK_SIZE
> +		   >= minix_sb(inode->i_sb)->s_max_size) {
>  		if (printk_ratelimit())
>  			printk("MINIX-fs: block_to_path: "
>  			       "block %ld too big on dev %s\n",
> diff --git a/fs/minix/itree_v2.c b/fs/minix/itree_v2.c
> index 13487ad..4a9a19d 100644
> --- a/fs/minix/itree_v2.c
> +++ b/fs/minix/itree_v2.c
> @@ -32,7 +32,8 @@ static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
>  	if (block < 0) {
>  		printk("MINIX-fs: block_to_path: block %ld < 0 on dev %s\n",
>  			block, bdevname(sb->s_bdev, b));
> -	} else if (block >= (minix_sb(inode->i_sb)->s_max_size/sb->s_blocksize)) {
> +	} else if ((u64) block * (u64) sb->s_blocksize
> +		   >= minix_sb(inode->i_sb)->s_max_size) {
>  		if (printk_ratelimit())
>  			printk("MINIX-fs: block_to_path: "
>  			       "block %ld too big on dev %s\n",
> 


-- 
Jan Kara <jack@xxxxxxx>
SUSE Labs, CR
--
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