FROMGIT: 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>
(cherry picked from commit 2cd5889641d59eac9b60b329b2e901fc7d6b7a3b
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
linux-6.1.y)
BUG=b:464994767
TEST=cq
Change-Id: I4d38a1a8ba9089e08688758492227c425b98c594
Fixes: 6070123d5344 ("HID: hid-ntrig: fix unable to handle page fault in ntrig_report_version()", v6.1.150)
Signed-off-by: Lina Versace <linyaa@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/7413581
Reviewed-by: Sean Paul <sean@poorly.run>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Suleiman Souhlal <suleiman@google.com>
1 file changed