Skip to content

Commit

Permalink
iomap: Add another assertion to inline data handling
Browse files Browse the repository at this point in the history
Check that the file tail does not cross a page boundary.  Requested by
Andreas.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
  • Loading branch information
Matthew Wilcox (Oracle) authored and Darrick J. Wong committed Aug 5, 2021
1 parent ab069d5 commit ae44f9c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/iomap/buffered-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ static int iomap_read_inline_data(struct inode *inode, struct page *page,
if (PageUptodate(page))
return PAGE_SIZE - poff;

if (WARN_ON_ONCE(size > PAGE_SIZE - poff))
return -EIO;
if (WARN_ON_ONCE(size > PAGE_SIZE -
offset_in_page(iomap->inline_data)))
return -EIO;
Expand Down

0 comments on commit ae44f9c

Please sign in to comment.