]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
arm64: mm: avoid fdt_check_header() before the FDT is fully mapped
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 1 Aug 2016 11:29:31 +0000 (13:29 +0200)
committerWill Deacon <will.deacon@arm.com>
Mon, 1 Aug 2016 13:17:01 +0000 (14:17 +0100)
commit04a848106193b134741672f7e4e444b50c70b631
treece8d85138732f505690d9eaf86e4ca082c62eaaa
parent3146bc64d12377a74dbda12b96ea32da3774ae07
arm64: mm: avoid fdt_check_header() before the FDT is fully mapped

As reported by Zijun, the fdt_check_header() call in __fixmap_remap_fdt()
is not safe since it is not guaranteed that the FDT header is mapped
completely. Due to the minimum alignment of 8 bytes, the only fields we
can assume to be mapped are 'magic' and 'totalsize'.

Since the OF layer is in charge of validating the FDT image, and we are
only interested in making reasonably sure that the size field contains
a meaningful value, replace the fdt_check_header() call with an explicit
comparison of the magic field's value against the expected value.

Cc: <stable@vger.kernel.org>
Reported-by: Zijun Hu <zijun_hu@htc.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/mm/mmu.c