• Matthew Wilcox (Oracle)'s avatar
    filemap: Cache the value of vm_flags · dcfa24ba
    Matthew Wilcox (Oracle) authored
    After we have unlocked the mmap_lock for I/O, the file is pinned, but
    the VMA is not.  Checking this flag after that can be a use-after-free.
    It's not a terribly interesting use-after-free as it can only read one
    bit, and it's used to decide whether to read 2MB or 4MB.  But it
    upsets the automated tools and it's generally bad practice anyway,
    so let's fix it.
    
    Reported-by: syzbot+5b96d55e5b54924c77ad@syzkaller.appspotmail.com
    Fixes: 4687fdbb ("mm/filemap: Support VM_HUGEPAGE for file mappings")
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
    dcfa24ba
filemap.c 111 KB