diff mbox series

[3/3] HID: thrustmaster: Fix memory leak in thrustmaster_interrupts()

Message ID 20210730165333.25395-1-novikov@ispras.ru (mailing list archive)
State Mainlined
Commit c3800eed22d21c66912b4461a403b4448ed88d95
Delegated to: Jiri Kosina
Headers show
Series [1/3] HID: thrustmaster: Fix memory leaks in probe | expand

Commit Message

Evgeny Novikov July 30, 2021, 4:53 p.m. UTC
thrustmaster_interrupts() does not free memory for send_buf when
usb_interrupt_msg() fails. This is fixed by the given patch.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
---
 drivers/hid/hid-thrustmaster.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/hid/hid-thrustmaster.c b/drivers/hid/hid-thrustmaster.c
index 9cb4248f95af..d44550aa8805 100644
--- a/drivers/hid/hid-thrustmaster.c
+++ b/drivers/hid/hid-thrustmaster.c
@@ -173,6 +173,7 @@  static void thrustmaster_interrupts(struct hid_device *hdev)
 
 		if (ret) {
 			hid_err(hdev, "setup data couldn't be sent\n");
+			kfree(send_buf);
 			return;
 		}
 	}