[PATCH 0/4] Fix potential THC DMA issues
From: Even Xu
Date: Mon Nov 16 2026 - 03:27:19 EST
This patch set fix two potential THC DMA issues:
1. THC DMA buffers are rounded up to a 4 KB boundary, but callers may
allocate smaller receive buffers. Checking a frame against the DMA
capacity alone does not protect the destination when do DMA buffer
copying.
2. thc_swdma_read_start() quiesces device interrupts, stops RXDMA and
temporarily disables the I2C special controls. If reading the response
of a completed SWDMA transfer fails, thc_swdma_read_safe() skips
thc_swdma_read_completion(), leaving RXDMA stopped and the saved I2C
controls unrestored. Normal input processing can no longer resume.
The fixes are:
1. Add thc_rxdma_read_safe() and thc_swdma_read_safe() with an explicit
destination capacity to check both the DMA capacity and the supplied
size before copying.
2. Call thc_swdma_read_completion() even when reading the completed
response fails, so RXDMA and the saved I2C controls can be restored.
Even Xu (4):
HID: Intel-thc-hid: Intel-thc: Add safe DMA read interfaces
HID: Intel-thc-hid: Intel-quickspi: Use safe RXDMA reads
HID: Intel-thc-hid: Intel-quicki2c: Use safe DMA reads
HID: Intel-thc-hid: Intel-thc: Restore RXDMA after SWDMA operation
errors
.../intel-quicki2c/pci-quicki2c.c | 9 +-
.../intel-quicki2c/quicki2c-protocol.c | 7 +-
.../intel-quickspi/pci-quickspi.c | 12 +-
.../intel-quickspi/quickspi-dev.h | 7 ++
.../intel-thc-hid/intel-thc/intel-thc-dma.c | 103 ++++++++++++++----
.../intel-thc-hid/intel-thc/intel-thc-dma.h | 6 +
6 files changed, 115 insertions(+), 29 deletions(-)
--
2.43.0