Skip to content

Commit bfc8e67

Browse files
smfrenchgregkh
authored andcommitted
SMB3: fix readpage for large swap cache
commit f2a26a3 upstream. readpage was calculating the offset of the page incorrectly for the case of large swapcaches. loff_t offset = (loff_t)page->index << PAGE_SHIFT; As pointed out by Matthew Wilcox, this needs to use page_file_offset() to calculate the offset instead. Pages coming from the swap cache have page->index set to their index within the swapcache, not within the backing file. For a sufficiently large swapcache, we could have overlapping values of page->index within the same backing file. Suggested by: Matthew Wilcox (Oracle) <[email protected]> Cc: <[email protected]> # v5.7+ Reviewed-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent be561c0 commit bfc8e67

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/cifs/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4550,7 +4550,7 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
45504550

45514551
static int cifs_readpage(struct file *file, struct page *page)
45524552
{
4553-
loff_t offset = (loff_t)page->index << PAGE_SHIFT;
4553+
loff_t offset = page_file_offset(page);
45544554
int rc = -EACCES;
45554555
unsigned int xid;
45564556

0 commit comments

Comments
 (0)