From: Matthew Wilcox (Oracle) Date: Thu, 5 Aug 2021 03:07:34 +0000 (-0700) Subject: iomap: Add another assertion to inline data handling X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=ae44f9c286da3fbb3f827076403ea64fa9adfef2;p=linux.git iomap: Add another assertion to inline data handling Check that the file tail does not cross a page boundary. Requested by Andreas. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 8ee0211bea860..586d9d078ce10 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -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;