Commit Graph

2620 Commits

Author SHA1 Message Date
Dmitry Torokhov
f5f9e07060 Input: edt-ft5x06 - fix use-after-free in debugfs teardown
The commit 68743c500c ("Input: edt-ft5x06 - use per-client debugfs
directory") removed the manual debugfs teardown, relying on the I2C core
to handle it. However, this creates a window where debugfs files are
still accessible after edt_ft5x06_ts_teardown_debugfs() frees
tsdata->raw_buffer.

To prevent a use-after-free, protect the freeing of raw_buffer with the
device mutex and set raw_buffer to NULL. The debugfs read function
already checks if raw_buffer is NULL under the same mutex, so this
safely avoids the use-after-free.

Fixes: 68743c500c ("Input: edt-ft5x06 - use per-client debugfs directory")
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/adnJicDh-bTUaWXP@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-04-19 17:54:06 -07:00
Dmitry Torokhov
86a9e4f4ef Input: mk712 - remove driver
This touchscreen controller was used om Gateway AOL Connected Touchpad
released in 2000 and, according to Wikipedia, removed from the market
in October 2001 due to slow sales.

It looks like it can still be bought on eBay for $1000 but I really
doubt anyone will actually use it.

Remove the driver.

Link: https://patch.msgid.link/20240808172733.1194442-5-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-04-08 07:55:25 -07:00
Johan Hovold
f13b780092 Input: usbtouchscreen - refactor endpoint lookup
Use the common USB helpers for looking up bulk and interrupt endpoints
(and determining endpoint numbers) instead of open coding.

Note that the NEXIO data interface has two bulk endpoints (see commit
5197424cdc ("Input: usbtouchscreen - add NEXIO (or iNexio) support")
for the descriptors).

The lookup in probe handles both bulk-in and interrupt-in endpoints and
was added to handle NEXIO devices. Replace the open coded lookup with a
lookup for the common interrupt endpoint and an explicit fallback
accepting a bulk endpoint.

This iterates over the (two) endpoints twice for NEXIO devices but makes
it more clear what is going on.

Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260401082212.2180434-1-johan@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-04-01 10:37:38 -07:00
Val Packett
653f3100f5 Input: goodix-berlin - report a resolution of 10 units/mm
Without a reported resolution, userspace was assuming 1 unit/mm which
is wildly wrong: a regular smartphone is clearly not 2.4 meters tall.
Most applications do not care much for this kind of raw mm value,
but Phosh's on-screen keyboard would accidentally trigger swipe-to-close
gestures due to misinterpreting small movements as huge ones.

Do what the older goodix.c driver does and set the resolution to 10
units/mm to make sure the numbers calculated by userspace are reasonable.

Signed-off-by: Val Packett <val@packett.cool>
Link: https://patch.msgid.link/20260321073242.556253-1-val@packett.cool
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-25 09:08:17 -07:00
Dmitry Torokhov
79df764dbe Input: zinitix - use guard notation when acquiring mutex
Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-25 07:54:00 -07:00
Dmitry Torokhov
35ee82990d Input: wm97xx - use guard notation when acquiring mutex
Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-25 07:54:00 -07:00
Dmitry Torokhov
da52f4b27a Input: wdt87xx_i2c - switch to using cleanup functions
Start using __free() and guard() primitives to simplify the code
and error handling.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-25 07:53:59 -07:00
Dmitry Torokhov
e65407f838 Input: tsc2007 - use guard notation when acquiring mutexes
This makes the code more compact and error handling more robust.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-25 07:53:59 -07:00
Dmitry Torokhov
600a2db76b Input: sx8654 - use IRQF_NOAUTOEN when requesting interrupt
Instead of requesting interrupt normally and immediately disabling it
with call to disable_irq() use IRQF_NOAUTOEN to keep it disabled until
it is needed. This avoids a tiny window when interrupt is enabled but
not needed.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-25 07:53:59 -07:00
Dmitry Torokhov
a8f56931c4 Input: sx8654 - use guard notation when acquiring spinlock
Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-25 07:53:59 -07:00
Dmitry Torokhov
dc05a01180 Input: sur40 - use guard notation when acquiring spinlock
Guard notation simplifies code.

Also use list_first_entry() instead of list_entry() to emphasize intent.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-25 07:53:59 -07:00
Dmitry Torokhov
8665ceb926 Input: stmfts - use guard notation when acquiring mutex
Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-25 07:53:58 -07:00
Dmitry Torokhov
e3e82a9d08 Input: raydium_i2c_ts - switch to using cleanup functions
Start using __free() and guard() primitives to simplify the code
and error handling.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-25 07:53:58 -07:00
Dmitry Torokhov
738de07ddf Input: pixcir_i2c_ts - use guard notation when acquiring mutex
Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-25 07:53:58 -07:00
Dmitry Torokhov
9f33f4fd39 Input: novatek-nvt-ts - use guard notation when acquiring mutex
Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-25 07:53:58 -07:00
Dmitry Torokhov
7c011b6ddb Input: mxs-lradc-ts - use guard notation when acquiring spinlock
Guard notation simplifies code and shows critical section more clearly.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-25 07:53:57 -07:00
Dmitry Torokhov
03bf327434 Input: msg2638 - use guard notation when acquiring mutex
Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:56 -07:00
Dmitry Torokhov
11a64d6bb7 Input: mms114 - use guard notation when acquiring mutex
Guard notation simplifies code.

Also stop trying to check if input device is opened/in use in the
interrupt handler - the interrupt is disabled when device is closed or
suspended.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:55 -07:00
Dmitry Torokhov
7e1e5722e8 Input: mk712 - use guard notation when acquiring spinlock
Using guard notation makes the code more compact and error handling
more robust by ensuring that locks are released in all code paths
when control leaves critical section.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:55 -07:00
Dmitry Torokhov
8e4ae01d84 Input: melfas_mip4 - switch to using cleanup functions
Start using __free() and guard() primitives to simplify the code
and error handling.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:54 -07:00
Dmitry Torokhov
a00a9fad1c Input: lpc32xx_ts - use guard notation when acquiring mutex
Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:53 -07:00
Dmitry Torokhov
3092610fdc Input: iqs7211 - use cleanup facility for fwnodes
Use __free(fwnode_handle) cleanup facility to ensure that references to
acquired fwnodes are dropped at appropriate times automatically.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:53 -07:00
Dmitry Torokhov
3b5e7a6265 Input: iqs5xx - simplify parsing of firmware blob
Do not define or use iqs5xx_ihex_rec structure: the original code was
using just a couple of fields in it and instead used it to calculate
offset to record data. The data field was actually reserving space for
checksum.

Instead iterate through fields and advance pointer explicitly.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:52 -07:00
Dmitry Torokhov
582f32aa89 Input: iqs5xx - switch to using cleanup functions
Start using __free() and guard() primitives to simplify the code and error
handling.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:52 -07:00
Dmitry Torokhov
f1324109d1 Input: ipaq-micro-ts - use guard notation when acquiring mutex/spinlock
Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:51 -07:00
Dmitry Torokhov
445dcfc7f6 Input: imx6ul_tsc - use guard notation when acquiring mutex
Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:50 -07:00
Dmitry Torokhov
d2862b87ad Input: imagis - use guard notation when acquiring mutex
Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:50 -07:00
Dmitry Torokhov
ded32cc611 Input: hycon-hy46xx - use guard notation when acquiring mutex
Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:49 -07:00
Dmitry Torokhov
5568c1aeb3 Input: hideep - switch to using cleanup functions
Start using __free() and guard() primitives to simplify the code and error
handling.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:49 -07:00
Dmitry Torokhov
777f5b42f8 Input: goodix - switch to using cleanup functions in firmware code
Start using __free(firmware) to simplify the code and error handling.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:27 -07:00
Dmitry Torokhov
576c99f1a3 Input: exc3000 - use guard notation when acquiring mutex
Guard notation simplifies code.

Note that callers of exc3000_vendor_data_request() always expect
response, so it was adjusted to always wait for it.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:26 -07:00
Dmitry Torokhov
cec3bcec6f Input: elo - use guard notation when acquiring mutex
Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:26 -07:00
Dmitry Torokhov
e5c79d9f65 Input: elants_i2c - switch to using cleanup facilities
Start using __free() and guard() primitives to simplify the code
and error handling.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:25 -07:00
Dmitry Torokhov
8c187a4c15 Input: ektf2127 - use guard notation when acquiring mutex
Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:24 -07:00
Dmitry Torokhov
6e9b9192d6 Input: eeti_ts - use guard notation when acquiring mutexes
This makes the code more compact and error handling more robust.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:24 -07:00
Dmitry Torokhov
df2e75e070 Input: edt-ft5x06 - use guard notation when acquiring mutex
Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:23 -07:00
Dmitry Torokhov
a0a92414af Input: cyttsp - use guard notation when acquiring mutex
Guard notation simplifies code.

Also fix the touchscreen not being marked as suspended when noone has
opened/is using it.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:23 -07:00
Dmitry Torokhov
37115e7df5 Input: chipone_icn8318 - use guard notation when acquiring mutex
Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:22 -07:00
Dmitry Torokhov
b29be7bae3 Input: bu21029_ts - use guard notation when acquiring mutex
Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:21 -07:00
Dmitry Torokhov
24b3bc4a8f Input: auo-pixcir-ts - use guard notation when acquiring mutexes
This makes the code more compact and error handling more robust.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:21 -07:00
Dmitry Torokhov
d911a55b29 Input: atmel_mxt_ts - switch to using cleanup functions
Start using __free() and guard() primitives to simplify the code
and error handling.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:20 -07:00
Dmitry Torokhov
d77c45c8f0 Input: ads7846 - switch to using cleanup functions
Start using __free() and guard() primitives to simplify the code
and error handling.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:20 -07:00
Dmitry Torokhov
ab2a830017 Input: ad7879 - use guard notation when acquiring mutexes
This makes the code more compact and error handling more robust.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:19 -07:00
Dmitry Torokhov
f3488759a5 Input: ad7877 - use guard notation when acquiring mutexes/locks
This makes the code more compact and error handling more robust.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-03-24 21:14:18 -07:00
Dmitry Torokhov
0421ccdfad Linux 7.0-rc3
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCgA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAmmuDMYeHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGLO4IAJ5kpRUi1STiqseb
 bLawF3gehuZp8VPAYnJsACYXN7kMx9OQJ2SE4Y0Y16ZlHtS1TTvsEAhwSTyYH7Jc
 hb1iSfoN1kxgDh2U3yZZJz9+DzQh6/YCDXJjyhpSgWOejhaYe7r7er5xqdKpGgVx
 6hlvN92/c1m7aqMjKNXeD7YKoXn35FzwPYQAyksJdwMWbq27HE1Vb42PHht21yUX
 1ndEUw0UMYH3IrDON+7QtE/aXW1PlLLeQWPDpG9y5FhoseZFEcNkm5NVYshuZ8L4
 WZj3Q5IvQ/zj9DuwagW4Gab9XwzKIWSXuuSLRyQzv+OcAyITiC+Uo3z55TFmvXs7
 2DOHBkY=
 =depW
 -----END PGP SIGNATURE-----

Merge tag 'v7.0-rc3' into next

Sync up with the mainline to brig up the latest changes, specifically
changes to ALPS driver.
2026-03-12 10:44:42 -07:00
Linus Torvalds
bf4afc53b7 Convert 'alloc_obj' family to use the new default GFP_KERNEL argument
This was done entirely with mindless brute force, using

    git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' |
        xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'

to convert the new alloc_obj() users that had a simple GFP_KERNEL
argument to just drop that argument.

Note that due to the extreme simplicity of the scripting, any slightly
more complex cases spread over multiple lines would not be triggered:
they definitely exist, but this covers the vast bulk of the cases, and
the resulting diff is also then easier to check automatically.

For the same reason the 'flex' versions will be done as a separate
conversion.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-02-21 17:09:51 -08:00
Kees Cook
69050f8d6d treewide: Replace kmalloc with kmalloc_obj for non-scalar types
This is the result of running the Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to
avoid scalar types (which need careful case-by-case checking), and
instead replace kmalloc-family calls that allocate struct or union
object instances:

Single allocations:	kmalloc(sizeof(TYPE), ...)
are replaced with:	kmalloc_obj(TYPE, ...)

Array allocations:	kmalloc_array(COUNT, sizeof(TYPE), ...)
are replaced with:	kmalloc_objs(TYPE, COUNT, ...)

Flex array allocations:	kmalloc(struct_size(PTR, FAM, COUNT), ...)
are replaced with:	kmalloc_flex(*PTR, FAM, COUNT, ...)

(where TYPE may also be *VAR)

The resulting allocations no longer return "void *", instead returning
"TYPE *".

Signed-off-by: Kees Cook <kees@kernel.org>
2026-02-21 01:02:28 -08:00
Michael Tretter
ffcdb6856a Input: st1232 - expose firmware version via sysfs
Allow user space programs to read the firmware version and revision of
the touch controller from the sysfs.

Suggested-by: Khalid Talash <ktalash@topcon.com>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Link: https://patch.msgid.link/20260123-input-st1232-firmware-version-v1-2-32df7eefdafe@pengutronix.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-02-17 23:04:43 -08:00
Michael Tretter
004703baa5 Input: st1232 - read firmware version and revision
According to the data sheet, the st1332 contains a firmware, which may
be updated. The version and revision of the firmware may be read from
the registers of the device.

Read the firmware version and revision and report it to the log when
probing the device.

Suggested-by: Khalid Talash <ktalash@topcon.com>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Link: https://patch.msgid.link/20260123-input-st1232-firmware-version-v1-1-32df7eefdafe@pengutronix.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2026-02-17 23:04:42 -08:00
Linus Torvalds
348e77b814 Input updates for v7.0-rc0
- support for FocalTech FT8112 added to i2c-hid driver
 
 - support for FocalTech FT3518 added to edt-ft5x06 driver
 
 - support for power buttons in TWL603x chips added to twl4030-pwrbutton
   driver
 
 - an update to gpio-decoder driver to make it usable on non-OF
   platforms and to clean up the code
 
 - an update to synaptics_i2c driver switching it to use managed
   resources and a fix to restarting polling after resume
 
 - an update to gpio-keys driver to fall back to getting IRQ from
   resources if not specified using other means
 
 - an update to ili210x driver to support polling mode
 
 - a number of input drivers switched to scnprintf() to suppress
   truncation warnings
 
 - a number of updates and conversions of device tree bindings to yaml
   format
 
 - fixes to spelling in comments and messages in several drivers
 
 - other assorted fixups.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQST2eWILY88ieB2DOtAj56VGEWXnAUCaZDuRwAKCRBAj56VGEWX
 nMDgAQDru/JJP8OzAOzkBVBKv4gq2/Sgcd9gnIWdbLmOgk/vyQD9FkurIYZeiPOJ
 8F/q0bhQPh72TlWF5mmD9A8PB48BFgs=
 =0l6r
 -----END PGP SIGNATURE-----

Merge tag 'input-for-v7.0-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input updates from Dmitry Torokhov:

 - support for FocalTech FT8112 added to i2c-hid driver

 - support for FocalTech FT3518 added to edt-ft5x06 driver

 - support for power buttons in TWL603x chips added to twl4030-pwrbutton
   driver

 - an update to gpio-decoder driver to make it usable on non-OF
   platforms and to clean up the code

 - an update to synaptics_i2c driver switching it to use managed
   resources and a fix to restarting polling after resume

 - an update to gpio-keys driver to fall back to getting IRQ from
   resources if not specified using other means

 - an update to ili210x driver to support polling mode

 - a number of input drivers switched to scnprintf() to suppress
   truncation warnings

 - a number of updates and conversions of device tree bindings to yaml
   format

 - fixes to spelling in comments and messages in several drivers

 - other assorted fixups

* tag 'input-for-v7.0-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (57 commits)
  dt-bindings: input: qcom,pm8941-pwrkey: Document PMM8654AU
  dt-bindings: input: touchscreen: imagis: allow linux,keycodes for ist3038
  Input: apbps2 - fix comment style and typos
  Input: gpio_keys - fall back to platform_get_irq() for interrupt-only keys
  Input: novatek-nvt-ts - drop wake_type check
  dt-bindings: input: touchscreen: tsc2007: document '#io-channel-cells'
  Input: ili210x - add support for polling mode
  dt-bindings: touchscreen: trivial-touch: Drop 'interrupts' requirement for old Ilitek
  Input: appletouch - fix potential race between resume and open
  HID: i2c-hid: Add FocalTech FT8112
  dt-bindings: input: i2c-hid: Introduce FocalTech FT8112
  Input: synaptics_i2c - switch to using managed resources
  Input: synaptics_i2c - guard polling restart in resume
  Input: gpio_decoder - don't use "proxy" headers
  Input: gpio_decoder - make use of the macros from bits.h
  Input: gpio_decoder - replace custom loop by gpiod_get_array_value_cansleep()
  Input: gpio_decoder - unify messages with help of dev_err_probe()
  Input: gpio_decoder - make use of device properties
  Input: serio - complete sizeof(*pointer) conversions
  Input: wdt87xx_i2c - switch to use dev_err_probe()
  ...
2026-02-15 08:24:19 -08:00