Commit d2849fb2 authored by Jan Kara's avatar Jan Kara Committed by Mark Fasheh

ocfs2: Safer read_inline_data()

In ocfs2_read_inline_data() we should store file size in loff_t. Although
the file size should fit in 32 bits we cannot be sure in case filesystem is
corrupted.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
parent 5fa0613e
...@@ -217,7 +217,7 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page, ...@@ -217,7 +217,7 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page,
struct buffer_head *di_bh) struct buffer_head *di_bh)
{ {
void *kaddr; void *kaddr;
unsigned int size; loff_t size;
struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
if (!(le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_DATA_FL)) { if (!(le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_DATA_FL)) {
...@@ -231,8 +231,9 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page, ...@@ -231,8 +231,9 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page,
if (size > PAGE_CACHE_SIZE || if (size > PAGE_CACHE_SIZE ||
size > ocfs2_max_inline_data(inode->i_sb)) { size > ocfs2_max_inline_data(inode->i_sb)) {
ocfs2_error(inode->i_sb, ocfs2_error(inode->i_sb,
"Inode %llu has with inline data has bad size: %u", "Inode %llu has with inline data has bad size: %Lu",
(unsigned long long)OCFS2_I(inode)->ip_blkno, size); (unsigned long long)OCFS2_I(inode)->ip_blkno,
(unsigned long long)size);
return -EROFS; return -EROFS;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment