[PATCH v2] HID: Input: Add battery list cleanup with devm action
Lucas Zampieri
lcasmz54 em gmail.com
Ter Jun 2 00:44:51 -03 2026
Hi Rafael,
Thanks for catching this and the quick fix. Turns out this is the
hidinput_cleanup_battery() hunk we dropped in the devm conversion
(patch 1/3), figuring devm would handle the cleanup. It frees the
hid_battery structs fine, but never unlinks them from hdev->batteries,
which outlives the devm scope, so the list dangles into freed memory on
the next probe. My bad.
Acked-by: Lucas Zampieri <lcasmz54 em gmail.com>
Mais detalhes sobre a lista de discussão kernel