Skip to content

Commit d0f1d5a

Browse files
eunovmJiri Kosina
authored andcommitted
HID: thrustmaster: Fix memory leaks in probe
When thrustmaster_probe() handles errors of usb_submit_urb() it does not free allocated resources and fails. The patch fixes that. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Evgeny Novikov <novikov@ispras.ru> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent df04fbe commit d0f1d5a

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/hid/hid-thrustmaster.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,14 @@ static int thrustmaster_probe(struct hid_device *hdev, const struct hid_device_i
336336
);
337337

338338
ret = usb_submit_urb(tm_wheel->urb, GFP_ATOMIC);
339-
if (ret)
339+
if (ret) {
340340
hid_err(hdev, "Error %d while submitting the URB. I am unable to initialize this wheel...\n", ret);
341+
goto error6;
342+
}
341343

342344
return ret;
343345

346+
error6: kfree(tm_wheel->change_request);
344347
error5: kfree(tm_wheel->response);
345348
error4: kfree(tm_wheel->model_request);
346349
error3: usb_free_urb(tm_wheel->urb);

0 commit comments

Comments
 (0)