Skip to content

HID: lenovo: two ordering fixes in remove() and tpkbd probe

Oleg Keri linux-input lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2HID: lenovo: stop the hardware before the per-model teardowndrivers/hid/hid-lenovo.c+2 -20 replies
2/2HID: lenovo: allocate the trackpoint drvdata before exposing its sysfs attributesdrivers/hid/hid-lenovo.c+5 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] HID: lenovo: two ordering fixes in remove() and tpkbd probe

Two long-standing ordering bugs in hid-lenovo, both pointed out by the Sashiko review of an unrelated patch of mine [1]. Neither is specific to any recent change; the first dates from 2020, the second from the original 2012 trackpoint keyboard driver.

Patch 1: lenovo_remove() cancels the tablet keyboards' fn_lock_sync_work while the hardware is still delivering the events that re-queue it, so a key press in that window leaves the work pending across the devres free of its data. Stop the hardware before the per-model teardown.

Patch 2: lenovo_probe_tpkbd() exposes sysfs attributes before allocating the drvdata they dereference. Allocate first.

Compile-tested only: I have neither a ThinkPad 10 Ultrabook Keyboard nor a ThinkPad USB Keyboard with TrackPoint. Both changes are pure reorderings of existing calls.

[1] https://lore.kernel.org/all/[email protected]/

Oleg Keri (2):
HID: lenovo: stop the hardware before the per-model teardown
HID: lenovo: allocate the trackpoint drvdata before exposing its sysfs
attributes

 drivers/hid/hid-lenovo.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
Signature · 4 lines
2.55.0


base-commit: df2908090cda368b01ff43709f51890076c56157