linux/drivers/input
Ranjan Kumar df2b818fa0 Input: elan_i2c - prevent division by zero and arithmetic underflow
The Elan I2C touchpad driver queries the device for its physical
dimensions and trace counts to calculate the device resolution and width.
However, if the device firmware or device tree provides invalid zero
values for x_traces or y_traces, it results in a fatal division-by-zero
exception leading to a kernel panic during device probe.

Add checks to ensure these parameters are non-zero before performing
the division. If invalid trace values are detected, fall back to a safe
default of 1.

Additionally, prevent an arithmetic underflow in the touch reporting
logic. Previously, if the calculated or fallback width was smaller than
ETP_FWIDTH_REDUCE (90), the subtraction would underflow, resulting in a
massive unsigned integer being reported to userspace. Clamp the adjusted
width to a minimum of 0 to safely handle small physical dimensions and
fallback scenarios.

Completing the probe with safe fallback values ensures the sysfs nodes
are created, keeping the firmware update path intact so a recovery
firmware can be flashed to the device.

Fixes: 6696777c65 ("Input: add driver for Elan I2C/SMbus touchpad")
Fixes: e3a9a12906 ("Input: elan_i2c - do not query the info if they are provided")
Signed-off-by: Ranjan Kumar <kumarranja@chromium.org>
Link: https://patch.msgid.link/20260612060339.3829666-1-kumarranja@chromium.org
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-06-22 22:33:02 -07:00
..
gameport Input: Drop unused assignments from pnp_device_id arrays 2026-06-10 09:56:01 -07:00
joystick Input: iforce - bound the device-reported force-feedback effect index 2026-06-22 20:55:41 -07:00
keyboard Input: ipaq-micro-keys - add length check in micro_key_receive 2026-06-11 13:52:18 -07:00
misc Input: remove changelogs 2026-06-10 11:04:17 -07:00
mouse Input: elan_i2c - prevent division by zero and arithmetic underflow 2026-06-22 22:33:02 -07:00
rmi4 Input: rmi4 - update formatting in F12 2026-06-11 22:39:30 -07:00
serio Input: Drop unused assignments from pnp_device_id arrays 2026-06-10 09:56:01 -07:00
tablet Input: remove changelogs 2026-06-10 11:04:17 -07:00
tests Input updates for v6.11-rc0 2024-07-19 16:51:39 -07:00
touchscreen Input: goodix - clamp the device-reported contact count 2026-06-22 20:44:12 -07:00
apm-power.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
evdev.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ff-core.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ff-memless.c Input: stop force-feedback timer when unregistering input devices 2026-06-22 22:33:01 -07:00
input-compat.c Input: move input_bits_to_string() to input-compat.c 2025-08-21 12:00:58 -07:00
input-compat.h Input: move input_bits_to_string() to input-compat.c 2025-08-21 12:00:58 -07:00
input-core-private.h Input: deactivate MT slots when inhibiting or suspending devices 2022-07-20 11:35:13 -07:00
input-leds.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
input-mt.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
input-poller.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
input-poller.h
input.c Input: stop force-feedback timer when unregistering input devices 2026-06-22 22:33:01 -07:00
joydev.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
Kconfig Input: remove evbug driver 2024-12-17 13:53:52 -08:00
Makefile Input: touch-overlay - add touchscreen overlay handling 2025-07-27 01:41:21 -07:00
matrix-keymap.c Input: matrix-keymap - switch to using __free() cleanup facility 2024-08-29 10:59:30 -07:00
mousedev.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
sparse-keymap.c Input: include export.h in modules using EXPORT_SYMBOL*() 2025-08-21 12:00:59 -07:00
touch-overlay.c Input: include export.h in modules using EXPORT_SYMBOL*() 2025-08-21 12:00:59 -07:00
touchscreen.c Input: include export.h in modules using EXPORT_SYMBOL*() 2025-08-21 12:00:59 -07:00
vivaldi-fmap.c Input: add missing MODULE_DESCRIPTION() macros 2024-06-09 14:38:48 -07:00