linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: sony: 4.10 fixes
@ 2017-02-23 23:56 Roderick Colenbrander
  2017-02-23 23:56 ` [PATCH] HID: sony: Fix input device leak when connecting a DS4 twice using USB/BT Roderick Colenbrander
  0 siblings, 1 reply; 3+ messages in thread
From: Roderick Colenbrander @ 2017-02-23 23:56 UTC (permalink / raw)
  To: linux-input
  Cc: Dmitry Torokhov, Jiri Kosina, Benjamin Tissoires, Simon Wood,
	Frank Praznik, Tim Bird, Roderick Colenbrander

From: Roderick Colenbrander <roderick.colenbrander@sony.com>

Hi,

During testing of patches we are currently working on, we noticed
an input device cleanup issue when connecting a single DS4 using
Bluetooth and USB. This issue leads to memory leaks and in some
conditions likely a crash, so we recommend adding the attached
patch. Long-term we probably want to do 'sony_add' checks earlier
on within sony_input_configured as well to prevent any transient
devices from happening in such situation in the first place, but
this patch at least fixes the cleanup.

Thanks,
Roderick

Roderick Colenbrander (1):
  HID: sony: Fix input device leak when connecting a DS4 twice using
    USB/BT

 drivers/hid/hid-sony.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.9.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] HID: sony: Fix input device leak when connecting a DS4 twice using USB/BT
  2017-02-23 23:56 [PATCH] HID: sony: 4.10 fixes Roderick Colenbrander
@ 2017-02-23 23:56 ` Roderick Colenbrander
  2017-02-24  7:02   ` Jiri Kosina
  0 siblings, 1 reply; 3+ messages in thread
From: Roderick Colenbrander @ 2017-02-23 23:56 UTC (permalink / raw)
  To: linux-input
  Cc: Dmitry Torokhov, Jiri Kosina, Benjamin Tissoires, Simon Wood,
	Frank Praznik, Tim Bird, Roderick Colenbrander

From: Roderick Colenbrander <roderick.colenbrander@sony.com>

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.
---
 drivers/hid/hid-sony.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index f405b07..740996f 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -2632,6 +2632,8 @@ static int sony_input_configured(struct hid_device *hdev,
 		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);
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] HID: sony: Fix input device leak when connecting a DS4 twice using USB/BT
  2017-02-23 23:56 ` [PATCH] HID: sony: Fix input device leak when connecting a DS4 twice using USB/BT Roderick Colenbrander
@ 2017-02-24  7:02   ` Jiri Kosina
  0 siblings, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2017-02-24  7:02 UTC (permalink / raw)
  To: Roderick Colenbrander
  Cc: linux-input, Dmitry Torokhov, Benjamin Tissoires, Simon Wood,
	Frank Praznik, Tim Bird, Roderick Colenbrander

On Thu, 23 Feb 2017, Roderick Colenbrander wrote:

> From: Roderick Colenbrander <roderick.colenbrander@sony.com>
> 
> 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.

Hi Roderick,

thanks for the fix. Could you please ammend and resend with:

- proper Signed-off-by: line
- ideally 'Fixes:' tag as well

Thanks,

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-24  7:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-23 23:56 [PATCH] HID: sony: 4.10 fixes Roderick Colenbrander
2017-02-23 23:56 ` [PATCH] HID: sony: Fix input device leak when connecting a DS4 twice using USB/BT Roderick Colenbrander
2017-02-24  7:02   ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).