]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
HID: hid-ntrig: Prevent memory leak in ntrig_report_version()
authorMasami Ichikawa <masami256@gmail.com>
Sun, 21 Sep 2025 05:31:02 +0000 (14:31 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Dec 2025 21:12:35 +0000 (06:12 +0900)
commit2cd5889641d59eac9b60b329b2e901fc7d6b7a3b
treed38736c02372229d0dc09ff59f0ac2c9490b007e
parent4ce2a0c3b8497a66cfc25fc7ca3d087258a785d2
HID: hid-ntrig: Prevent memory leak in ntrig_report_version()

[ Upstream commit 53f731f5bba0cf03b751ccceb98b82fadc9ccd1e ]

Use a scope-based cleanup helper for the buffer allocated with kmalloc()
in ntrig_report_version() to simplify the cleanup logic and prevent
memory leaks (specifically the !hid_is_usb()-case one).

[jkosina@suse.com: elaborate on the actual existing leak]
Fixes: 185c926283da ("HID: hid-ntrig: fix unable to handle page fault in ntrig_report_version()")
Signed-off-by: Masami Ichikawa <masami256@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/hid-ntrig.c