All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] HID: sony: 4.10 fixes
@ 2017-02-25  0:14 Roderick Colenbrander
  2017-02-25  0:14 ` [PATCH v2] HID: sony: Fix input device leak when connecting a DS4 twice using USB/BT Roderick Colenbrander
  0 siblings, 1 reply; 4+ messages in thread
From: Roderick Colenbrander @ 2017-02-25  0:14 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,

This is an updated version of the fix taking Jiri's feedback into
account.

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] 4+ messages in thread

* [PATCH v2] HID: sony: Fix input device leak when connecting a DS4 twice using USB/BT
  2017-02-25  0:14 [PATCH v2] HID: sony: 4.10 fixes Roderick Colenbrander
@ 2017-02-25  0:14 ` Roderick Colenbrander
  2017-03-01 17:18   ` Benjamin Tissoires
  2017-03-06 13:21   ` Jiri Kosina
  0 siblings, 2 replies; 4+ messages in thread
From: Roderick Colenbrander @ 2017-02-25  0:14 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.

Fixes: ac797b95f532 ("HID: sony: Make the DS4 touchpad a separate device")
Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
---
 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] 4+ messages in thread

* Re: [PATCH v2] HID: sony: Fix input device leak when connecting a DS4 twice using USB/BT
  2017-02-25  0:14 ` [PATCH v2] HID: sony: Fix input device leak when connecting a DS4 twice using USB/BT Roderick Colenbrander
@ 2017-03-01 17:18   ` Benjamin Tissoires
  2017-03-06 13:21   ` Jiri Kosina
  1 sibling, 0 replies; 4+ messages in thread
From: Benjamin Tissoires @ 2017-03-01 17:18 UTC (permalink / raw)
  To: Roderick Colenbrander
  Cc: linux-input, Dmitry Torokhov, Jiri Kosina, Simon Wood,
	Frank Praznik, Tim Bird, Roderick Colenbrander

On Feb 24 2017 or thereabouts, 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.
> 
> Fixes: ac797b95f532 ("HID: sony: Make the DS4 touchpad a separate device")
> Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
> ---

Looks good to me:
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

>  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	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] HID: sony: Fix input device leak when connecting a DS4 twice using USB/BT
  2017-02-25  0:14 ` [PATCH v2] HID: sony: Fix input device leak when connecting a DS4 twice using USB/BT Roderick Colenbrander
  2017-03-01 17:18   ` Benjamin Tissoires
@ 2017-03-06 13:21   ` Jiri Kosina
  1 sibling, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2017-03-06 13:21 UTC (permalink / raw)
  To: Roderick Colenbrander
  Cc: linux-input, Dmitry Torokhov, Benjamin Tissoires, Simon Wood,
	Frank Praznik, Tim Bird, Roderick Colenbrander

On Fri, 24 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.
> 
> Fixes: ac797b95f532 ("HID: sony: Make the DS4 touchpad a separate device")
> Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>

I've added -stable anotation and applied to for-4.11/upstream-fixes. 
Thanks,

-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2017-03-06 15:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-25  0:14 [PATCH v2] HID: sony: 4.10 fixes Roderick Colenbrander
2017-02-25  0:14 ` [PATCH v2] HID: sony: Fix input device leak when connecting a DS4 twice using USB/BT Roderick Colenbrander
2017-03-01 17:18   ` Benjamin Tissoires
2017-03-06 13:21   ` Jiri Kosina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.