linux-stable/kernel/dma
Nicolin Chen f46cc01525 dma-contiguous: page-align the size in dma_free_contiguous()
According to the original dma_direct_alloc_pages() code:
{
	unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT;

	if (!dma_release_from_contiguous(dev, page, count))
		__free_pages(page, get_order(size));
}

The count parameter for dma_release_from_contiguous() was page
aligned before the right-shifting operation, while the new API
dma_free_contiguous() forgets to have PAGE_ALIGN() at the size.

So this patch simply adds it to prevent any corner case.

Fixes: fdaeec198ada ("dma-contiguous: add dma_{alloc,free}_contiguous() helpers")
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
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: page-align the size in dma_free_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