[PATCH 4.18 006/158] HID: input: fix leaking custom input node name

From: Greg Kroah-Hartman
Date: Mon Sep 17 2018 - 19:08:39 EST


4.18-stable review patch. If anyone has any objections, please let me know.

------------------

From: Stefan Agner <stefan@xxxxxxxx>

commit e38c0ac55ee67cf3626cfbc2283f8873dc44d370 upstream.

Make sure to free the custom input node name on disconnect.

Cc: stable@xxxxxxxxxxxxxxx # v4.18+
Fixes: c554bb045511 ("HID: input: append a suffix matching the application")
Signed-off-by: Stefan Agner <stefan@xxxxxxxx>
Signed-off-by: Jiri Kosina <jkosina@xxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/hid/hid-input.c | 1 +
1 file changed, 1 insertion(+)

--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1812,6 +1812,7 @@ void hidinput_disconnect(struct hid_devi
input_unregister_device(hidinput->input);
else
input_free_device(hidinput->input);
+ kfree(hidinput->name);
kfree(hidinput);
}