diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2026-08-30 13:52:48 -0700 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2026-09-20 12:52:10 -0700 |
| commit | e73972da25a81844b6f86ceaf4b27e280bfc219c (patch) | |
| tree | 73fcbb1353eb15f92781316e9da1d30def714777 /tools/perf/scripts/python/stackcollapse.py | |
| parent | 66ea7cb72f9e45e268c2032a8d2b106775eebb99 (diff) | |
Input: gscps2 - protect buffer access in read and report helpers
In gscps2_report_data(), the ring buffer consumer index ps2port->act was
read and updated locklessly. When gscps2_interrupt() was called from
process context (such as during port write or open) concurrently with a
hardware interrupt running on another CPU, two execution contexts could
execute gscps2_report_data() simultaneously for the same port, racing on
ps2port->act and leading to duplicate, skipped, or out-of-order bytes.
Protect buffer access by taking ps2port->lock inside gscps2_read_data()
and gscps2_report_data(). In gscps2_report_data(), acquire ps2port->lock
only when popping entries from the ring buffer and release it before
calling serio_interrupt() to avoid recursive deadlocks if the input
driver synchronously sends a command back via serio_write().
Reported-by: sashiko-bot@kernel.org
Assisted-by: LLM
Link: https://patch.msgid.link/20260830-gscps2-v1-3-c733d4cae7f9@gmail.com
Acked-by: Helge Deller <deller@gmx.de>
Tested-by: Helge Deller <deller@gmx.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
