• Russell King's avatar
    ARM: dma-mapping: disallow dma_get_sgtable() for non-kernel managed memory · 916a008b
    Russell King authored
    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: default avatarShuah Khan <shuahkhan@gmail.com>
    Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
    916a008b
dma-mapping.c 63.5 KB