* [PATCH] hid: elo: fix memory leak in elo_probe
@ 2022-01-22 9:48 Dongliang Mu
2022-01-24 8:04 ` Jiri Kosina
0 siblings, 1 reply; 2+ messages in thread
From: Dongliang Mu @ 2022-01-22 9:48 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Salah Triki
Cc: Dongliang Mu, syzkaller, Jiri Kosina, linux-input, linux-kernel
From: Dongliang Mu <mudongliangabcd@gmail.com>
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>
---
drivers/hid/hid-elo.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/hid/hid-elo.c b/drivers/hid/hid-elo.c
index 8e960d7b233b..9b42b0cdeef0 100644
--- a/drivers/hid/hid-elo.c
+++ b/drivers/hid/hid-elo.c
@@ -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;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hid: elo: fix memory leak in elo_probe
2022-01-22 9:48 [PATCH] hid: elo: fix memory leak in elo_probe Dongliang Mu
@ 2022-01-24 8:04 ` Jiri Kosina
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2022-01-24 8:04 UTC (permalink / raw)
To: Dongliang Mu
Cc: Benjamin Tissoires, Salah Triki, Dongliang Mu, syzkaller,
linux-input, linux-kernel
On Sat, 22 Jan 2022, Dongliang Mu wrote:
> From: Dongliang Mu <mudongliangabcd@gmail.com>
>
> 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>
> ---
> drivers/hid/hid-elo.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/hid/hid-elo.c b/drivers/hid/hid-elo.c
> index 8e960d7b233b..9b42b0cdeef0 100644
> --- a/drivers/hid/hid-elo.c
> +++ b/drivers/hid/hid-elo.c
> @@ -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;
Applied, thank you.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-24 8:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-22 9:48 [PATCH] hid: elo: fix memory leak in elo_probe Dongliang Mu
2022-01-24 8:04 ` Jiri Kosina
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.