[PATCH 0/2] Fix double allocation in swiotlb_alloc()

From: Will Deacon
Date: Fri Jan 26 2024 - 10:20:43 EST


Hi folks,

These two patches fix a nasty double allocation problem in swiotlb_alloc()
and add a diagnostic to help catch any similar issues in future. This was
a royal pain to track down and I've had to make a bit of a leap at the
correct alignment semantics (i.e. iotlb_align_mask vs alloc_align_mask).

Without these changes, we've been observing random vsock hangs when
communicating with virtual machines in Android.

Please have a look!

Cheers,

Will

Cc: iommu@xxxxxxxxxxxxxxx
Cc: Christoph Hellwig <hch@xxxxxx>
Cc: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
Cc: Robin Murphy <robin.murphy@xxxxxxx>
Cc: Petr Tesarik <petr.tesarik1@xxxxxxxxxxxxxxxxxxx>
Cc: Dexuan Cui <decui@xxxxxxxxxxxxx>

--->8

Will Deacon (2):
swiotlb: Fix allocation alignment requirement when searching slots
swiotlb: Enforce page alignment in swiotlb_alloc()

kernel/dma/swiotlb.c | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)

--
2.43.0.429.g432eaa2c6b-goog