linux/kernel/dma
Nicolin Chen c6622a425a dma-contiguous: do not overwrite align in dma_alloc_contiguous()
The dma_alloc_contiguous() limits align at CONFIG_CMA_ALIGNMENT for
cma_alloc() however it does not restore it for the fallback routine.
This will result in a size mismatch between the allocation and free
when running into the fallback routines after cma_alloc() fails, if
the align is larger than CONFIG_CMA_ALIGNMENT.

This patch adds a cma_align to take care of cma_alloc() and prevent
the align from being overwritten.

Fixes: fdaeec198ada ("dma-contiguous: add dma_{alloc,free}_contiguous() helpers")
Reported-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2019-07-29 09:50:04 +03:00
..
coherent.c dma-mapping: remove the DMA_MEMORY_EXCLUSIVE flag 2019-02-20 07:27:00 -07:00
contiguous.c dma-contiguous: do not overwrite align in dma_alloc_contiguous() 2019-07-29 09:50:04 +03:00
debug.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333 2019-06-05 17:37:06 +02:00
direct.c dma-direct: correct the physical addr in dma_direct_sync_sg_for_cpu/device 2019-07-19 14:09:40 +02:00
dummy.c dma-mapping: factor out dummy DMA ops 2018-12-13 21:06:12 +01:00
Kconfig dma-direct: Force unencrypted DMA under SME for certain DMA masks 2019-07-16 22:15:46 +02:00
Makefile dma-mapping: improve selection of dma_declare_coherent availability 2019-02-20 07:26:35 -07:00
mapping.c dma-mapping: truncate dma masks to what dma_addr_t can hold 2019-06-25 07:54:06 +02:00
remap.c dma-direct: handle DMA_ATTR_NO_KERNEL_MAPPING in common code 2019-06-25 14:28:05 +02:00
swiotlb.c Merge branch 'for-linus-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb 2019-07-18 11:48:05 -07:00
virt.c dma-mapping: zero memory returned from dma_alloc_* 2018-12-20 08:13:52 +01:00