]> asedeno.scripts.mit.edu Git - linux.git/commit
ARM: dma-mapping: disallow dma_get_sgtable() for non-kernel managed memory
authorRussell King <rmk+kernel@armlinux.org.uk>
Wed, 29 Mar 2017 16:12:47 +0000 (17:12 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Wed, 29 Mar 2017 16:36:23 +0000 (17:36 +0100)
commit916a008b4b8ecc02fbd035cfb133773dba1ff3d7
treef6351a31fb0e342e73862f4a7c3425d8c418033e
parenta1016e94cce9fb6ea56d7602263783e2d95d6e92
ARM: dma-mapping: disallow dma_get_sgtable() for non-kernel managed memory

dma_get_sgtable() tries to create a scatterlist table containing valid
struct page pointers for the coherent memory allocation passed in to it.

However, memory can be declared via dma_declare_coherent_memory(), or
via other reservation schemes which means that coherent memory is not
guaranteed to be backed by struct pages.  In such cases, the resulting
scatterlist table contains pointers to invalid pages, which causes
kernel oops later.

This patch adds detection of such memory, and refuses to create a
scatterlist table for such memory.

Reported-by: Shuah Khan <shuahkhan@gmail.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
arch/arm/mm/dma-mapping.c