Skip to content

Commit 1af2071

Browse files
YuuoniyJiri Kosina
authored andcommitted
HID: elan: Fix potential double free in elan_input_configured
'input' is a managed resource allocated with devm_input_allocate_device(), so there is no need to call input_free_device() explicitly or there will be a double free. According to the doc of devm_input_allocate_device(): * Managed input devices do not need to be explicitly unregistered or * freed as it will be done automatically when owner device unbinds from * its driver (or binding fails). Fixes: b7429ea ("HID: elan: Fix memleak in elan_input_configured") Fixes: 9a6a419 ("HID: Add driver for USB ELAN Touchpad") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent 116c3f4 commit 1af2071

1 file changed

Lines changed: 0 additions & 2 deletions

File tree

drivers/hid/hid-elan.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi)
188188
ret = input_mt_init_slots(input, ELAN_MAX_FINGERS, INPUT_MT_POINTER);
189189
if (ret) {
190190
hid_err(hdev, "Failed to init elan MT slots: %d\n", ret);
191-
input_free_device(input);
192191
return ret;
193192
}
194193

@@ -200,7 +199,6 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi)
200199
hid_err(hdev, "Failed to register elan input device: %d\n",
201200
ret);
202201
input_mt_destroy_slots(input);
203-
input_free_device(input);
204202
return ret;
205203
}
206204

0 commit comments

Comments
 (0)