Thread (3 messages) 3 messages, 2 authors, 2020-08-31

[PATCH] HID: elan: Fix memleak in elan_input_configured

flat view
STALE2237d

From: Dinghao Liu <hidden>
Date: 2020-08-24 07:24:13
Also in: lkml
Subsystem: hid core layer, the rest · Maintainers: Jiri Kosina, Benjamin Tissoires, Linus Torvalds

When input_mt_init_slots() fails, input should be
freed to prevent memleak.

Fixes: 9a6a4193d65b8 ("HID: Add driver for USB ELAN Touchpad")
Signed-off-by: Dinghao Liu <redacted>
---
 drivers/hid/hid-elan.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/hid/hid-elan.c b/drivers/hid/hid-elan.c
index 45c4f888b7c4..858442004258 100644
--- a/drivers/hid/hid-elan.c
+++ b/drivers/hid/hid-elan.c
@@ -188,6 +188,7 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi)
 	ret = input_mt_init_slots(input, ELAN_MAX_FINGERS, INPUT_MT_POINTER);
 	if (ret) {
 		hid_err(hdev, "Failed to init elan MT slots: %d\n", ret);
+		input_free_device(input);
 		return ret;
 	}
 
-- 
2.17.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help