The patch titled Subject: mm/ioremap: check virtual address alignment while creating huge mappings has been added to the -mm tree. Its filename is mm-ioremap-check-virtual-address-alignment-while-creating-huge-mappings.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-ioremap-check-virtual-address-alignment-while-creating-huge-mappings.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-ioremap-check-virtual-address-alignment-while-creating-huge-mappings.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Anshuman Khandual <anshuman.khandual@xxxxxxx> Subject: mm/ioremap: check virtual address alignment while creating huge mappings Virtual address alignment is essential in ensuring correct clearing for all intermediate level pgtable entries and freeing associated pgtable pages. An unaligned address can end up randomly freeing pgtable page that potentially still contains valid mappings. Hence also check it's alignment along with existing phys_addr check. Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx> Reviewed-by: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Toshi Kani <toshi.kani@xxxxxxx> Cc: Will Deacon <will.deacon@xxxxxxx> Cc: Chintan Pandya <cpandya@xxxxxxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- lib/ioremap.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/lib/ioremap.c~mm-ioremap-check-virtual-address-alignment-while-creating-huge-mappings +++ a/lib/ioremap.c @@ -86,6 +86,9 @@ static int ioremap_try_huge_pmd(pmd_t *p if ((end - addr) != PMD_SIZE) return 0; + if (!IS_ALIGNED(addr, PMD_SIZE)) + return 0; + if (!IS_ALIGNED(phys_addr, PMD_SIZE)) return 0; @@ -126,6 +129,9 @@ static int ioremap_try_huge_pud(pud_t *p if ((end - addr) != PUD_SIZE) return 0; + if (!IS_ALIGNED(addr, PUD_SIZE)) + return 0; + if (!IS_ALIGNED(phys_addr, PUD_SIZE)) return 0; @@ -166,6 +172,9 @@ static int ioremap_try_huge_p4d(p4d_t *p if ((end - addr) != P4D_SIZE) return 0; + if (!IS_ALIGNED(addr, P4D_SIZE)) + return 0; + if (!IS_ALIGNED(phys_addr, P4D_SIZE)) return 0; _ Patches currently in -mm which might be from anshuman.khandual@xxxxxxx are mm-dev_pfn-exclude-memory_device_private-while-computing-virtual-address.patch mm-pgtable-drop-pgtable_t-variable-from-pte_fn_t-functions.patch mm-ioremap-check-virtual-address-alignment-while-creating-huge-mappings.patch