• Steve French's avatar
    SMB3: fix readpage for large swap cache · f2a26a3c
    Steve French authored
    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) <willy@infradead.org>
    Cc: <stable@vger.kernel.org> # v5.7+
    Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
    Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
    f2a26a3c
file.c 126 KB