Fix potential THC DMA issues
Status from this message: I have applied the series, thanks.
Get series with b4
b4 am [email protected]Versions newest first
Patches in v1 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | HID: Intel-thc-hid: Intel-thc: Add safe DMA read interfacesdrivers/ drivers/ | +86 | 2 replies | |
| 2/4 | HID: Intel-thc-hid: Intel-quickspi: Use safe RXDMA readsdrivers/ drivers/ | +15 | 0 replies | |
| 3/4 | HID: Intel-thc-hid: Intel-quicki2c: Use safe DMA readsdrivers/ drivers/ | +10 | 0 replies | |
| 4/4 | HID: Intel-thc-hid: Intel-thc: Restore RXDMA after SWDMA operation errorsdrivers/ | +4 | 0 replies |
Reviews trailers per patch
None of the 4 patches has a Reviewed-by or Acked-by.
| Patch | Rui Zhang |
|---|---|
| 1/4 | T-b |
| 2/4 | T-b |
| 3/4 | T-b |
| 4/4 | T-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
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