]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
HID: asus: avoid memory leak in asus_report_fixup()
authorGünther Noack <gnoack@google.com>
Thu, 19 Feb 2026 15:43:38 +0000 (16:43 +0100)
committerBenjamin Tissoires <bentiss@kernel.org>
Thu, 19 Feb 2026 17:57:38 +0000 (18:57 +0100)
commit2bad24c17742fc88973d6aea526ce1353f5334a3
tree6388d4e0a3eb9e78db06c4d3936d70f608ecc5a1
parent91e8c6e601bdc1ccdf886479b6513c01c7e51c2c
HID: asus: avoid memory leak in asus_report_fixup()

The asus_report_fixup() function was returning a newly allocated
kmemdup()-allocated buffer, but never freeing it.  Switch to
devm_kzalloc() to ensure the memory is managed and freed automatically
when the device is removed.

The caller of report_fixup() does not take ownership of the returned
pointer, but it is permitted to return a pointer whose lifetime is at
least that of the input buffer.

Also fix a harmless out-of-bounds read by copying only the original
descriptor size.

Assisted-by: Gemini-CLI:Google Gemini 3
Signed-off-by: Günther Noack <gnoack@google.com>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
drivers/hid/hid-asus.c