summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRoderick Colenbrander <roderick.colenbrander@sony.com>2017-02-24 16:14:15 -0800
committerJiri Kosina <jkosina@suse.cz>2017-03-06 14:43:16 +0100
commita687c5765b5ae19fe559e14615ddc87ebb46d409 (patch)
tree437a1d7ac9f5981b20f9869349f9a455873040cc /drivers
parentf2f10b7e722a75c6d75a7f7cd06b0eee3ae20f7c (diff)
HID: sony: Fix input device leak when connecting a DS4 twice using USB/BT
When a user connects a DS4 twice using USB and BT, we reject the second device connection after the setup work. We then perform a cleanup, but during cleanup we are not removing the touchpad device. This leads to leakage of an input device, which we would never remove. It can likely result into a kernel oops as well when the touchpad evdev node is accessed and the underlaying HID device has been removed from the system. [jkosina@suse.cz: added stable annotation] Fixes: ac797b95f532 ("HID: sony: Make the DS4 touchpad a separate device") Cc: stable@vger.kernel.org Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hid/hid-sony.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index f405b07d0381..740996f9bdd4 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -2632,6 +2632,8 @@ err_stop:
sony_leds_remove(sc);
if (sc->quirks & SONY_BATTERY_SUPPORT)
sony_battery_remove(sc);
+ if (sc->touchpad)
+ sony_unregister_touchpad(sc);
sony_cancel_work_sync(sc);
kfree(sc->output_report_dmabuf);
sony_remove_dev_list(sc);