diff options
author | David S. Miller <davem@davemloft.net> | 2017-06-30 12:43:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-30 12:43:08 -0400 |
commit | b07911593719828cac023bdcf6bf4da1c9ba546f (patch) | |
tree | c4d2f66e6f2506e5b5439ffca0449e646f677b33 /mm/vmalloc.c | |
parent | 52a623bd6189b6ea8f06a0d7594c7604deaab24a (diff) | |
parent | 4d8a991d460d4fa4829beaffdcba45a217ca0fa7 (diff) | |
download | op-kernel-dev-b07911593719828cac023bdcf6bf4da1c9ba546f.zip op-kernel-dev-b07911593719828cac023bdcf6bf4da1c9ba546f.tar.gz |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
A set of overlapping changes in macvlan and the rocker
driver, nothing serious.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r-- | mm/vmalloc.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 34a1c3e..ecc97f7 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -287,10 +287,21 @@ struct page *vmalloc_to_page(const void *vmalloc_addr) if (p4d_none(*p4d)) return NULL; pud = pud_offset(p4d, addr); - if (pud_none(*pud)) + + /* + * Don't dereference bad PUD or PMD (below) entries. This will also + * identify huge mappings, which we may encounter on architectures + * that define CONFIG_HAVE_ARCH_HUGE_VMAP=y. Such regions will be + * identified as vmalloc addresses by is_vmalloc_addr(), but are + * not [unambiguously] associated with a struct page, so there is + * no correct value to return for them. + */ + WARN_ON_ONCE(pud_bad(*pud)); + if (pud_none(*pud) || pud_bad(*pud)) return NULL; pmd = pmd_offset(pud, addr); - if (pmd_none(*pmd)) + WARN_ON_ONCE(pmd_bad(*pmd)); + if (pmd_none(*pmd) || pmd_bad(*pmd)) return NULL; ptep = pte_offset_map(pmd, addr); |