]> git.baikalelectronics.ru Git - kernel.git/commit
iommu/dma: Use correct offset in map_sg
authorRobin Murphy <robin.murphy@arm.com>
Mon, 4 Jan 2016 16:19:42 +0000 (16:19 +0000)
committerJoerg Roedel <jroedel@suse.de>
Thu, 7 Jan 2016 12:36:41 +0000 (13:36 +0100)
commit4639484a532693e4a01a6b10a0d1d276b1a8be73
tree04af5245fdc9d8d565bf443bae484673230b4395
parentf961fe9d5a4339ce5d3b7b3ce821608f43609b22
iommu/dma: Use correct offset in map_sg

When mapping a non-page-aligned scatterlist entry, we copy the original
offset to the output DMA address before aligning it to hand off to
iommu_map_sg(), then later adding the IOVA page address portion to get
the final mapped address. However, when the IOVA page size is smaller
than the CPU page size, it is the offset within the IOVA page we want,
not that within the CPU page, which can easily be larger than an IOVA
page and thus result in an incorrect final address.

Fix the bug by taking only the IOVA-aligned part of the offset as the
basis of the DMA address, not the whole thing.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/dma-iommu.c