]> git.baikalelectronics.ru Git - kernel.git/commit
filemap: Cache the value of vm_flags
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 25 May 2022 18:23:45 +0000 (14:23 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 9 Jun 2022 20:24:25 +0000 (16:24 -0400)
commita084280e8714ee8a83bf1825eb19b6b7ea417407
tree1095030522aad702805d25d23b91fe13320fabb9
parent00704560ec43d457b13aca3e0953d3b9d84f921f
filemap: Cache the value of vm_flags

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: bb527e717ffd ("mm/filemap: Support VM_HUGEPAGE for file mappings")
Cc: stable@vger.kernel.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
mm/filemap.c