Skip to content

Commit

Permalink
HID: sony: Fix a potential memory leak in sony_probe()
Browse files Browse the repository at this point in the history
[ Upstream commit e1cd400 ]

If an error occurs after a successful usb_alloc_urb() call, usb_free_urb()
should be called.

Fixes: fb1a79a ("HID: sony: fix freeze when inserting ghlive ps3/wii dongles")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
tititiou36 authored and gregkh committed Oct 10, 2023
1 parent 6e3ae29 commit f237b17
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/hid/hid-sony.c
Original file line number Diff line number Diff line change
Expand Up @@ -3074,6 +3074,9 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
return ret;

err:
if (sc->ghl_urb)
usb_free_urb(sc->ghl_urb);

hid_hw_stop(hdev);
return ret;
}
Expand Down

0 comments on commit f237b17

Please sign in to comment.