diff options
| author | Marek Szyprowski <m.szyprowski@samsung.com> | 2026-11-03 16:50:15 +0100 |
|---|---|---|
| committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2026-11-05 09:06:06 +0100 |
| commit | 5b4b87935bf9c6c81b603558c2e167fc27c22a1b (patch) | |
| tree | a1b26bc26d44215fc1192546b68a3768a05f6df0 /kernel/debug | |
| parent | ca010d38da7bf05a4572a54c2c16d6d64a758c3a (diff) | |
dma: swiotlb: Round restricted DMA pool size down to IO_TLB_SEGSIZE
All other paths creating a swiotlb pool ensure that nslabs is a multiple
of IO_TLB_SEGSIZE, and the swiotlb code relies on that. Since commit
0b84e4f8b793 ("swiotlb: Add restricted DMA pool initialization") a
restricted pool can have an arbitrary size taken from the device tree.
If the pool size is not a multiple of IO_TLB_SEGSIZE, the last segment is
partial and swiotlb_release_slots() reads mem->slots[index + nslabs],
which is one past the end of the slots array when the freed buffer ends
at the end of the pool:
BUG: KASAN: slab-out-of-bounds in swiotlb_release_slots
Read of size 2
Round the pool size down to a multiple of IO_TLB_SEGSIZE, wasting a bit
of memory, and warn about it.
Reported-by: Giorgi Kobakhia <gkobakhi@asu.edu>
Closes: https://lore.kernel.org/all/20261026032007.1957949-1-gkobakhi@asu.edu/
Fixes: 0b84e4f8b793 ("swiotlb: Add restricted DMA pool initialization")
CC: stable@vger.kernel.org
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Link: https://lore.kernel.org/r/20261103155016.1107958-1-m.szyprowski@samsung.com
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Diffstat (limited to 'kernel/debug')
0 files changed, 0 insertions, 0 deletions
