diff options
author | Hans de Goede <hdegoede@redhat.com> | 2022-03-01 09:59:34 +0300 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2022-03-01 10:26:30 +0300 |
commit | 65de58c2a5b4bbe8ee1a42a5ee5b88163efa9855 (patch) | |
tree | b9baf75b005ef2461437d74cac991a21a3c0c3ee /drivers/input/touchscreen/goodix.h | |
parent | ae8e80c5f18dd08cc0c1ba43a17e11cf8b495d66 (diff) | |
download | linux-65de58c2a5b4bbe8ee1a42a5ee5b88163efa9855.tar.xz |
Input: goodix - fix race on driver unbind
Because there is no way to detect if the touchscreen has pen support,
the driver is allocating and registering the input_pen input_dev on
receiving the first pen event.
But this means that the input_dev gets allocated after the request_irq()
call which means that the devm framework will free it before disabling
the irq, leaving a window where the irq handler may run and reference the
free-ed input_dev.
To fix this move the allocation of the input_pen input_dev to before
the request_irq() call, while still only registering it on the first pen
event so that the driver does not advertise pen capability on touchscreens
without it (most goodix touchscreens do not have pen support).
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20220131143539.109142-4-hdegoede@redhat.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/touchscreen/goodix.h')
-rw-r--r-- | drivers/input/touchscreen/goodix.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/goodix.h b/drivers/input/touchscreen/goodix.h index fa8602e78a64..87797cc88b32 100644 --- a/drivers/input/touchscreen/goodix.h +++ b/drivers/input/touchscreen/goodix.h @@ -94,6 +94,7 @@ struct goodix_ts_data { u16 version; bool reset_controller_at_probe; bool load_cfg_from_disk; + int pen_input_registered; struct completion firmware_loading_complete; unsigned long irq_flags; enum goodix_irq_pin_access_method irq_pin_access_method; |