stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] HID: multitouch: fix sticky fingers" failed to apply to 6.12-stable tree
@ 2025-10-20  8:14 gregkh
  2025-10-20 12:43 ` [PATCH 6.12.y] HID: multitouch: fix sticky fingers bentiss
  0 siblings, 1 reply; 4+ messages in thread
From: gregkh @ 2025-10-20  8:14 UTC (permalink / raw)
  To: bentiss, jkosina; +Cc: stable


The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 46f781e0d151844589dc2125c8cce3300546f92a
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2025102008-likewise-rubbing-d48b@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^..

Possible dependencies:



thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 46f781e0d151844589dc2125c8cce3300546f92a Mon Sep 17 00:00:00 2001
From: Benjamin Tissoires <bentiss@kernel.org>
Date: Wed, 8 Oct 2025 16:06:58 +0200
Subject: [PATCH] HID: multitouch: fix sticky fingers

The sticky fingers quirk (MT_QUIRK_STICKY_FINGERS) was only considering
the case when slots were not released during the last report.
This can be problematic if the firmware forgets to release a finger
while others are still present.

This was observed on the Synaptics DLL0945 touchpad found on the Dell
XPS 9310 and the Dell Inspiron 5406.

Fixes: 4f4001bc76fd ("HID: multitouch: fix rare Win 8 cases when the touch up event gets missing")
Cc: stable@vger.kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>

diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 513b8673ad8d..179dc316b4b5 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -94,9 +94,8 @@ enum report_mode {
 	TOUCHPAD_REPORT_ALL = TOUCHPAD_REPORT_BUTTONS | TOUCHPAD_REPORT_CONTACTS,
 };
 
-#define MT_IO_FLAGS_RUNNING		0
-#define MT_IO_FLAGS_ACTIVE_SLOTS	1
-#define MT_IO_FLAGS_PENDING_SLOTS	2
+#define MT_IO_SLOTS_MASK		GENMASK(7, 0) /* reserve first 8 bits for slot tracking */
+#define MT_IO_FLAGS_RUNNING		32
 
 static const bool mtrue = true;		/* default for true */
 static const bool mfalse;		/* default for false */
@@ -172,7 +171,11 @@ struct mt_device {
 	struct timer_list release_timer;	/* to release sticky fingers */
 	struct hid_haptic_device *haptic;	/* haptic related configuration */
 	struct hid_device *hdev;	/* hid_device we're attached to */
-	unsigned long mt_io_flags;	/* mt flags (MT_IO_FLAGS_*) */
+	unsigned long mt_io_flags;	/* mt flags (MT_IO_FLAGS_RUNNING)
+					 * first 8 bits are reserved for keeping the slot
+					 * states, this is fine because we only support up
+					 * to 250 slots (MT_MAX_MAXCONTACT)
+					 */
 	__u8 inputmode_value;	/* InputMode HID feature value */
 	__u8 maxcontacts;
 	bool is_buttonpad;	/* is this device a button pad? */
@@ -986,6 +989,7 @@ static void mt_release_pending_palms(struct mt_device *td,
 
 	for_each_set_bit(slotnum, app->pending_palm_slots, td->maxcontacts) {
 		clear_bit(slotnum, app->pending_palm_slots);
+		clear_bit(slotnum, &td->mt_io_flags);
 
 		input_mt_slot(input, slotnum);
 		input_mt_report_slot_inactive(input);
@@ -1019,12 +1023,6 @@ static void mt_sync_frame(struct mt_device *td, struct mt_application *app,
 	app->left_button_state = 0;
 	if (td->is_haptic_touchpad)
 		hid_haptic_pressure_reset(td->haptic);
-
-	if (test_bit(MT_IO_FLAGS_ACTIVE_SLOTS, &td->mt_io_flags))
-		set_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags);
-	else
-		clear_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags);
-	clear_bit(MT_IO_FLAGS_ACTIVE_SLOTS, &td->mt_io_flags);
 }
 
 static int mt_compute_timestamp(struct mt_application *app, __s32 value)
@@ -1202,7 +1200,9 @@ static int mt_process_slot(struct mt_device *td, struct input_dev *input,
 		input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
 		input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
 
-		set_bit(MT_IO_FLAGS_ACTIVE_SLOTS, &td->mt_io_flags);
+		set_bit(slotnum, &td->mt_io_flags);
+	} else {
+		clear_bit(slotnum, &td->mt_io_flags);
 	}
 
 	return 0;
@@ -1337,7 +1337,7 @@ static void mt_touch_report(struct hid_device *hid,
 	 * defect.
 	 */
 	if (app->quirks & MT_QUIRK_STICKY_FINGERS) {
-		if (test_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags))
+		if (td->mt_io_flags & MT_IO_SLOTS_MASK)
 			mod_timer(&td->release_timer,
 				  jiffies + msecs_to_jiffies(100));
 		else
@@ -1814,6 +1814,7 @@ static void mt_release_contacts(struct hid_device *hid)
 			for (i = 0; i < mt->num_slots; i++) {
 				input_mt_slot(input_dev, i);
 				input_mt_report_slot_inactive(input_dev);
+				clear_bit(i, &td->mt_io_flags);
 			}
 			input_mt_sync_frame(input_dev);
 			input_sync(input_dev);
@@ -1836,7 +1837,7 @@ static void mt_expired_timeout(struct timer_list *t)
 	 */
 	if (test_and_set_bit_lock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags))
 		return;
-	if (test_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags))
+	if (td->mt_io_flags & MT_IO_SLOTS_MASK)
 		mt_release_contacts(hdev);
 	clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags);
 }


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

* [PATCH 6.12.y] HID: multitouch: fix sticky fingers
  2025-10-20  8:14 FAILED: patch "[PATCH] HID: multitouch: fix sticky fingers" failed to apply to 6.12-stable tree gregkh
@ 2025-10-20 12:43 ` bentiss
  2025-10-20 12:52   ` Benjamin Tissoires
  0 siblings, 1 reply; 4+ messages in thread
From: bentiss @ 2025-10-20 12:43 UTC (permalink / raw)
  To: stable; +Cc: Benjamin Tissoires, Jiri Kosina

From: Benjamin Tissoires <bentiss@kernel.org>

commit 46f781e0d151844589dc2125c8cce3300546f92a upstream.

The sticky fingers quirk (MT_QUIRK_STICKY_FINGERS) was only considering
the case when slots were not released during the last report.
This can be problematic if the firmware forgets to release a finger
while others are still present.

This was observed on the Synaptics DLL0945 touchpad found on the Dell
XPS 9310 and the Dell Inspiron 5406.

Fixes: 4f4001bc76fd ("HID: multitouch: fix rare Win 8 cases when the touch up event gets missing")
Cc: stable@vger.kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
---
 drivers/hid/hid-multitouch.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 5c424010bc02..0667a24576fc 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -83,9 +83,8 @@ enum latency_mode {
 	HID_LATENCY_HIGH = 1,
 };
 
-#define MT_IO_FLAGS_RUNNING		0
-#define MT_IO_FLAGS_ACTIVE_SLOTS	1
-#define MT_IO_FLAGS_PENDING_SLOTS	2
+#define MT_IO_SLOTS_MASK		GENMASK(7, 0) /* reserve first 8 bits for slot tracking */
+#define MT_IO_FLAGS_RUNNING		32
 
 static const bool mtrue = true;		/* default for true */
 static const bool mfalse;		/* default for false */
@@ -160,7 +159,11 @@ struct mt_device {
 	struct mt_class mtclass;	/* our mt device class */
 	struct timer_list release_timer;	/* to release sticky fingers */
 	struct hid_device *hdev;	/* hid_device we're attached to */
-	unsigned long mt_io_flags;	/* mt flags (MT_IO_FLAGS_*) */
+	unsigned long mt_io_flags;	/* mt flags (MT_IO_FLAGS_RUNNING)
+					 * first 8 bits are reserved for keeping the slot
+					 * states, this is fine because we only support up
+					 * to 250 slots (MT_MAX_MAXCONTACT)
+					 */
 	__u8 inputmode_value;	/* InputMode HID feature value */
 	__u8 maxcontacts;
 	bool is_buttonpad;	/* is this device a button pad? */
@@ -941,6 +944,7 @@ static void mt_release_pending_palms(struct mt_device *td,
 
 	for_each_set_bit(slotnum, app->pending_palm_slots, td->maxcontacts) {
 		clear_bit(slotnum, app->pending_palm_slots);
+		clear_bit(slotnum, &td->mt_io_flags);
 
 		input_mt_slot(input, slotnum);
 		input_mt_report_slot_inactive(input);
@@ -972,12 +976,6 @@ static void mt_sync_frame(struct mt_device *td, struct mt_application *app,
 
 	app->num_received = 0;
 	app->left_button_state = 0;
-
-	if (test_bit(MT_IO_FLAGS_ACTIVE_SLOTS, &td->mt_io_flags))
-		set_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags);
-	else
-		clear_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags);
-	clear_bit(MT_IO_FLAGS_ACTIVE_SLOTS, &td->mt_io_flags);
 }
 
 static int mt_compute_timestamp(struct mt_application *app, __s32 value)
@@ -1152,7 +1150,9 @@ static int mt_process_slot(struct mt_device *td, struct input_dev *input,
 		input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
 		input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
 
-		set_bit(MT_IO_FLAGS_ACTIVE_SLOTS, &td->mt_io_flags);
+		set_bit(slotnum, &td->mt_io_flags);
+	} else {
+		clear_bit(slotnum, &td->mt_io_flags);
 	}
 
 	return 0;
@@ -1287,7 +1287,7 @@ static void mt_touch_report(struct hid_device *hid,
 	 * defect.
 	 */
 	if (app->quirks & MT_QUIRK_STICKY_FINGERS) {
-		if (test_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags))
+		if (td->mt_io_flags & MT_IO_SLOTS_MASK)
 			mod_timer(&td->release_timer,
 				  jiffies + msecs_to_jiffies(100));
 		else
@@ -1734,6 +1734,7 @@ static void mt_release_contacts(struct hid_device *hid)
 			for (i = 0; i < mt->num_slots; i++) {
 				input_mt_slot(input_dev, i);
 				input_mt_report_slot_inactive(input_dev);
+				clear_bit(i, &td->mt_io_flags);
 			}
 			input_mt_sync_frame(input_dev);
 			input_sync(input_dev);
@@ -1756,7 +1757,7 @@ static void mt_expired_timeout(struct timer_list *t)
 	 */
 	if (test_and_set_bit_lock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags))
 		return;
-	if (test_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags))
+	if (td->mt_io_flags & MT_IO_SLOTS_MASK)
 		mt_release_contacts(hdev);
 	clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags);
 }
-- 
2.51.0


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

* Re: [PATCH 6.12.y] HID: multitouch: fix sticky fingers
  2025-10-20 12:43 ` [PATCH 6.12.y] HID: multitouch: fix sticky fingers bentiss
@ 2025-10-20 12:52   ` Benjamin Tissoires
  2025-10-20 13:27     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Tissoires @ 2025-10-20 12:52 UTC (permalink / raw)
  To: gregkh; +Cc: stable, Jiri Kosina

On Oct 20 2025, bentiss@kernel.org wrote:
> From: Benjamin Tissoires <bentiss@kernel.org>
> 
> commit 46f781e0d151844589dc2125c8cce3300546f92a upstream.
> 
> The sticky fingers quirk (MT_QUIRK_STICKY_FINGERS) was only considering
> the case when slots were not released during the last report.
> This can be problematic if the firmware forgets to release a finger
> while others are still present.
> 
> This was observed on the Synaptics DLL0945 touchpad found on the Dell
> XPS 9310 and the Dell Inspiron 5406.
> 
> Fixes: 4f4001bc76fd ("HID: multitouch: fix rare Win 8 cases when the touch up event gets missing")
> Cc: stable@vger.kernel.org
> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
> Signed-off-by: Jiri Kosina <jkosina@suse.com>
> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
> ---

Greg,

This backport also applies cleanly up to 5.10. Though I'm not sure we
want to go that far in the history TBH.

Can you also take this version and apply it to 6.1+? (or do you want me
to send individual rebases for each tree?)

Cheers,
Benjamin

>  drivers/hid/hid-multitouch.c | 27 ++++++++++++++-------------
>  1 file changed, 14 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
> index 5c424010bc02..0667a24576fc 100644
> --- a/drivers/hid/hid-multitouch.c
> +++ b/drivers/hid/hid-multitouch.c
> @@ -83,9 +83,8 @@ enum latency_mode {
>  	HID_LATENCY_HIGH = 1,
>  };
>  
> -#define MT_IO_FLAGS_RUNNING		0
> -#define MT_IO_FLAGS_ACTIVE_SLOTS	1
> -#define MT_IO_FLAGS_PENDING_SLOTS	2
> +#define MT_IO_SLOTS_MASK		GENMASK(7, 0) /* reserve first 8 bits for slot tracking */
> +#define MT_IO_FLAGS_RUNNING		32
>  
>  static const bool mtrue = true;		/* default for true */
>  static const bool mfalse;		/* default for false */
> @@ -160,7 +159,11 @@ struct mt_device {
>  	struct mt_class mtclass;	/* our mt device class */
>  	struct timer_list release_timer;	/* to release sticky fingers */
>  	struct hid_device *hdev;	/* hid_device we're attached to */
> -	unsigned long mt_io_flags;	/* mt flags (MT_IO_FLAGS_*) */
> +	unsigned long mt_io_flags;	/* mt flags (MT_IO_FLAGS_RUNNING)
> +					 * first 8 bits are reserved for keeping the slot
> +					 * states, this is fine because we only support up
> +					 * to 250 slots (MT_MAX_MAXCONTACT)
> +					 */
>  	__u8 inputmode_value;	/* InputMode HID feature value */
>  	__u8 maxcontacts;
>  	bool is_buttonpad;	/* is this device a button pad? */
> @@ -941,6 +944,7 @@ static void mt_release_pending_palms(struct mt_device *td,
>  
>  	for_each_set_bit(slotnum, app->pending_palm_slots, td->maxcontacts) {
>  		clear_bit(slotnum, app->pending_palm_slots);
> +		clear_bit(slotnum, &td->mt_io_flags);
>  
>  		input_mt_slot(input, slotnum);
>  		input_mt_report_slot_inactive(input);
> @@ -972,12 +976,6 @@ static void mt_sync_frame(struct mt_device *td, struct mt_application *app,
>  
>  	app->num_received = 0;
>  	app->left_button_state = 0;
> -
> -	if (test_bit(MT_IO_FLAGS_ACTIVE_SLOTS, &td->mt_io_flags))
> -		set_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags);
> -	else
> -		clear_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags);
> -	clear_bit(MT_IO_FLAGS_ACTIVE_SLOTS, &td->mt_io_flags);
>  }
>  
>  static int mt_compute_timestamp(struct mt_application *app, __s32 value)
> @@ -1152,7 +1150,9 @@ static int mt_process_slot(struct mt_device *td, struct input_dev *input,
>  		input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
>  		input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
>  
> -		set_bit(MT_IO_FLAGS_ACTIVE_SLOTS, &td->mt_io_flags);
> +		set_bit(slotnum, &td->mt_io_flags);
> +	} else {
> +		clear_bit(slotnum, &td->mt_io_flags);
>  	}
>  
>  	return 0;
> @@ -1287,7 +1287,7 @@ static void mt_touch_report(struct hid_device *hid,
>  	 * defect.
>  	 */
>  	if (app->quirks & MT_QUIRK_STICKY_FINGERS) {
> -		if (test_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags))
> +		if (td->mt_io_flags & MT_IO_SLOTS_MASK)
>  			mod_timer(&td->release_timer,
>  				  jiffies + msecs_to_jiffies(100));
>  		else
> @@ -1734,6 +1734,7 @@ static void mt_release_contacts(struct hid_device *hid)
>  			for (i = 0; i < mt->num_slots; i++) {
>  				input_mt_slot(input_dev, i);
>  				input_mt_report_slot_inactive(input_dev);
> +				clear_bit(i, &td->mt_io_flags);
>  			}
>  			input_mt_sync_frame(input_dev);
>  			input_sync(input_dev);
> @@ -1756,7 +1757,7 @@ static void mt_expired_timeout(struct timer_list *t)
>  	 */
>  	if (test_and_set_bit_lock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags))
>  		return;
> -	if (test_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags))
> +	if (td->mt_io_flags & MT_IO_SLOTS_MASK)
>  		mt_release_contacts(hdev);
>  	clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags);
>  }
> -- 
> 2.51.0
> 

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

* Re: [PATCH 6.12.y] HID: multitouch: fix sticky fingers
  2025-10-20 12:52   ` Benjamin Tissoires
@ 2025-10-20 13:27     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2025-10-20 13:27 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: stable, Jiri Kosina

On Mon, Oct 20, 2025 at 02:52:24PM +0200, Benjamin Tissoires wrote:
> On Oct 20 2025, bentiss@kernel.org wrote:
> > From: Benjamin Tissoires <bentiss@kernel.org>
> > 
> > commit 46f781e0d151844589dc2125c8cce3300546f92a upstream.
> > 
> > The sticky fingers quirk (MT_QUIRK_STICKY_FINGERS) was only considering
> > the case when slots were not released during the last report.
> > This can be problematic if the firmware forgets to release a finger
> > while others are still present.
> > 
> > This was observed on the Synaptics DLL0945 touchpad found on the Dell
> > XPS 9310 and the Dell Inspiron 5406.
> > 
> > Fixes: 4f4001bc76fd ("HID: multitouch: fix rare Win 8 cases when the touch up event gets missing")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
> > Signed-off-by: Jiri Kosina <jkosina@suse.com>
> > Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
> > ---
> 
> Greg,
> 
> This backport also applies cleanly up to 5.10. Though I'm not sure we
> want to go that far in the history TBH.
> 
> Can you also take this version and apply it to 6.1+? (or do you want me
> to send individual rebases for each tree?)

I've taken it back to 5.10.y as-is, thanks!

greg k-h

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

end of thread, other threads:[~2025-10-20 13:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-20  8:14 FAILED: patch "[PATCH] HID: multitouch: fix sticky fingers" failed to apply to 6.12-stable tree gregkh
2025-10-20 12:43 ` [PATCH 6.12.y] HID: multitouch: fix sticky fingers bentiss
2025-10-20 12:52   ` Benjamin Tissoires
2025-10-20 13:27     ` Greg KH

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).