Skip to content

Fix potential THC DMA issues

Even Xu linux-input lkml 1 version Applied

Status from this message: I have applied the series, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 2 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/4HID: Intel-thc-hid: Intel-thc: Add safe DMA read interfacesdrivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.c drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.h+86 -152 replies
2/4HID: Intel-thc-hid: Intel-quickspi: Use safe RXDMA readsdrivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c drivers/hid/intel-thc-hid/intel-quickspi/quickspi-dev.h+15 -40 replies
3/4HID: Intel-thc-hid: Intel-quicki2c: Use safe DMA readsdrivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c drivers/hid/intel-thc-hid/intel-quicki2c/quicki2c-protocol.c+10 -60 replies
4/4HID: Intel-thc-hid: Intel-thc: Restore RXDMA after SWDMA operation errorsdrivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.c+4 -40 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by.

PatchRui Zhang
1/4T-b
2/4T-b
3/4T-b
4/4T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] Fix potential THC DMA issues

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(-)
Signature · 1 line
2.43.0