HID: elo: fix memory leak in elo_probe

[ Upstream commit 817b8b9c53 ]

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: fbf42729d0 ("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>
This commit is contained in:
Dongliang Mu 2022-01-22 17:48:26 +08:00 коммит произвёл Greg Kroah-Hartman
Родитель ffe36e3a99
Коммит de0d102d0c
1 изменённых файлов: 1 добавлений и 0 удалений

Просмотреть файл

@ -262,6 +262,7 @@ static int elo_probe(struct hid_device *hdev, const struct hid_device_id *id)
return 0;
err_free:
usb_put_dev(udev);
kfree(priv);
return ret;
}