HID: elo: fix memory leak in elo_probe
authorDongliang Mu <mudongliangabcd@gmail.com>
Sat, 22 Jan 2022 09:48:26 +0000 (17:48 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Feb 2022 11:03:16 +0000 (12:03 +0100)
commitde0d102d0c8c681fc9a3263d842fb35f7cf662f4
tree5634c9a49d5febbad66f6f027f9f2515d0786d8a
parentffe36e3a991e604fc23c65313a401c2fe8b3ab0f
HID: elo: fix memory leak in elo_probe

[ Upstream commit 817b8b9c5396d2b2d92311b46719aad5d3339dbe ]

When hid_parse() in elo_probe() fails, it forgets to call usb_put_dev to
decrease the refcount.

Fix this by adding usb_put_dev() in the error handling code of elo_probe().

Fixes: fbf42729d0e9 ("HID: elo: update the reference count of the usb device structure")
Reported-by: syzkaller <syzkaller@googlegroups.com>
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/hid-elo.c