diff options
| author | Chen Changcheng <chenchangcheng@kylinos.cn> | 2026-07-27 09:34:59 +0800 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.com> | 2026-08-03 21:22:08 +0200 |
| commit | 9405601fb7649dc1d52e785c1b5717d7e9129613 (patch) | |
| tree | 120958f5cb36808bf90930e5c4b392d84f5ac779 /tools/perf/scripts/python/bin/flamegraph-record | |
| parent | 2884e21b18613708f050ec75330b265dd07ecc03 (diff) | |
HID: corsair: fix use-after-free by reordering remove sequence
The corsair_remove() function currently frees the k90 driver data before
calling hid_hw_stop(). Since hid_hw_stop() stops HID I/O, the event
callback corsair_event() can still be invoked between the kfree() and
hid_hw_stop(), and will dereference the freed drvdata->k90 pointer to
write record_led.brightness.
Reorder the remove sequence so that hid_hw_stop() is called first.
Once hid_hw_stop() completes, the HID device is disconnected and no
URBs are active, so corsair_event() cannot fire anymore. The driver
data is freed only afterwards.
Additionally, set drvdata->k90 to NULL after kfree() as a defensive
measure, matching the existing pattern in the error path of
k90_init_macro_functions().
Signed-off-by: Chen Changcheng <chenchangcheng@kylinos.cn>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Diffstat (limited to 'tools/perf/scripts/python/bin/flamegraph-record')
0 files changed, 0 insertions, 0 deletions
