Re: [PATCH 1/2] omfs: fix potential oops when directory size iscorrupted

From: Andrew Morton
Date: Fri Aug 15 2008 - 03:20:40 EST


On Thu, 14 Aug 2008 23:13:41 -0400 Bob Copeland <me@xxxxxxxxxxxxxxx> wrote:

> --- a/fs/omfs/inode.c
> +++ b/fs/omfs/inode.c
> @@ -232,8 +232,7 @@ struct inode *omfs_iget(struct super_block *sb, ino_t ino)
> inode->i_mode = S_IFDIR | (S_IRWXUGO & ~sbi->s_dmask);
> inode->i_op = &omfs_dir_inops;
> inode->i_fop = &omfs_dir_operations;
> - inode->i_size = be32_to_cpu(oi->i_head.h_body_size) +
> - sizeof(struct omfs_header);
> + inode->i_size = sbi->s_sys_blocksize;
> inc_nlink(inode);
> break;
> case OMFS_FILE:

We don't need to use i_size_write() on this code path, but we do in other
places. There's also i_size_read(). I wonder if omfs gets it right
everywhere..
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/