Skip to content

HID: multitouch: fix use-after-free of haptic data on delayed input release

Aldo Ariel Panzardo linux-input lkml llvm oe-kbuild-all stable 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v8 Latest2 patches 1 replyIn review
  2. v72 patches 1 replySuperseded
  3. v62 patches 0 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v52 patches0 repliesSuperseded
v41 patch1 replySuperseded

Patches in v8 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2HID: haptic: reorder try_module_get/get_device before input_ff_createdrivers/hid/hid-haptic.c+18 -200 replies
2/2HID: multitouch: fix use-after-free of haptic data on delayed input releasedrivers/hid/hid-haptic.c+66 -81 reply

Reviews trailers per patch

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

Read the v8 thread

Cover letter [PATCH v8 0/2] HID: multitouch: fix use-after-free of haptic data on delayed input release

v8 fixes issues found by Sashiko on v5-v7.

Patch 1 keeps input_set_capability(EV_FF) before input_ff_create() (ff->ffbit needs the bit), but clears both bits on failure via a new ff_cap_clear label so a masked error from the caller does not leave EV_FF set with a NULL dev->ff.

Patch 2 keeps the devm_add_action() design. Changes since v5:
- module_put in hid_haptic_destroy (not devm_release) so the module stays loaded until FF is done; __module_get for devm_release itself
- guard against double-init (return 0 when haptic->wq is set)
- NULL haptic->hdev and haptic->input_dev after put in devm_release
- restore dev->flush/event on devm_add_action failure

v7: https://lore.kernel.org/linux-input/[email protected]/
v5: https://lore.kernel.org/linux-input/[email protected]/
v4: https://lore.kernel.org/linux-input/[email protected]/
v1: https://lore.kernel.org/linux-input/[email protected]/

Aldo Ariel Panzardo (2):
HID: haptic: reorder try_module_get/get_device before input_ff_create
HID: multitouch: fix use-after-free of haptic data on delayed input
release

 drivers/hid/hid-haptic.c | 108 +++++++++++++++++++++++++++++++++------
 1 file changed, 82 insertions(+), 26 deletions(-)

--
2.53.0