Skip to content

Commit

Permalink
HID: thrustmaster: fix memory leak in thrustmaster_interrupts()
Browse files Browse the repository at this point in the history
[ Upstream commit 09d5463 ]

In thrustmaster_interrupts(), the allocated send_buf is not
freed if the usb_check_int_endpoints() check fails, leading
to a memory leak.

Fix this by ensuring send_buf is freed before returning in
the error path.

Fixes: 50420d7 ("HID: hid-thrustmaster: Fix warning in thrustmaster_probe by adding endpoint check")
Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Qasim Ijaz authored and Greg Kroah-Hartman committed May 22, 2025
1 parent 336edd6 commit a699995
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/hid/hid-thrustmaster.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ static void thrustmaster_interrupts(struct hid_device *hdev)
u8 ep_addr[2] = {b_ep, 0};

if (!usb_check_int_endpoints(usbif, ep_addr)) {
kfree(send_buf);
hid_err(hdev, "Unexpected non-int endpoint\n");
return;
}
Expand Down

0 comments on commit a699995

Please sign in to comment.