Thread (4 messages) 4 messages, 2 authors, 4d ago
COOLING4d

[PATCH 0/2] Input: applespi - probe and remove fixes

From: Shih-Yuan Lee <hidden>
Date: 2026-07-12 16:15:34
Also in: lkml

This series fixes two bugs in the applespi driver found during work to
restore MacBook8,1 SPI keyboard/touchpad functionality across S3
suspend/resume cycles.

Patch 1 fixes a probe-time regression introduced when the touchpad
registration was made asynchronous: a deferred workqueue task could
complete after the spi_device was already removed, causing a NULL pointer
dereference.  The fix registers the touchpad input device synchronously
in probe and removes the deferred path.

Patch 2 fixes a use-after-free race in applespi_remove().  The original
code called applespi_drain_writes(), then removed the GPE handler, then
called applespi_drain_reads() -- but any read completion arriving after
GPE removal would reference the already-torn-down applespi struct.  The
fix uses the existing cancel_spi + wait_event_lock_irq mechanism to
drain all in-flight SPI transfers atomically before proceeding with
teardown.

These patches are independent of the companion spi-pxa2xx series also
submitted today (MacBook8,1 DMA quirk and LPSS S3 resume fix).

Shih-Yuan Lee (2):
  Input: applespi - register touchpad device synchronously in probe
  Input: applespi - fix use-after-free in applespi_remove()

 drivers/input/keyboard/applespi.c | 160 ++++++++++++++++++++++++------
 1 file changed, 127 insertions(+), 33 deletions(-)

-- 
2.39.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help