Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH 0/4] Fix potential THC DMA issues
@ 2026-11-16  8:27 Even Xu
  2026-11-16  8:27 ` [PATCH 1/4] HID: Intel-thc-hid: Intel-thc: Add safe DMA read interfaces Even Xu
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Even Xu @ 2026-11-16  8:27 UTC (permalink / raw)
  To: bentiss, jikos; +Cc: srinivas.pandruvada, linux-input, linux-kernel, Even Xu

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-16  8:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16  8:27 [PATCH 0/4] Fix potential THC DMA issues Even Xu
2026-11-16  8:27 ` [PATCH 1/4] HID: Intel-thc-hid: Intel-thc: Add safe DMA read interfaces Even Xu
2026-11-16  8:27 ` [PATCH 2/4] HID: Intel-thc-hid: Intel-quickspi: Use safe RXDMA reads Even Xu
2026-11-16  8:27 ` [PATCH 3/4] HID: Intel-thc-hid: Intel-quicki2c: Use safe DMA reads Even Xu
2026-11-16  8:28 ` [PATCH 4/4] HID: Intel-thc-hid: Intel-thc: Restore RXDMA after SWDMA operation errors Even Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox