Linux kernel -stable discussions
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] Input: byd - synchronize timer deletion before freeing" failed to apply to 5.10-stable tree
@ 2026-08-20 11:07 gregkh
  2026-08-24 16:26 ` [PATCH 5.10.y] Input: byd - synchronize timer deletion before freeing private data Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: gregkh @ 2026-08-20 11:07 UTC (permalink / raw)
  To: lilinmao, dmitry.torokhov; +Cc: stable


The patch below does not apply to the 5.10-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-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x c83e79c0842ed29860648bcce5022ef0ba5001c6
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026082046-impound-leverage-8771@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'

Possible dependencies:



thanks,

greg k-h

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

From c83e79c0842ed29860648bcce5022ef0ba5001c6 Mon Sep 17 00:00:00 2001
From: Linmao Li <lilinmao@kylinos.cn>
Date: Mon, 20 Jul 2026 14:12:59 +0800
Subject: [PATCH] Input: byd - synchronize timer deletion before freeing
 private data

byd_disconnect() uses timer_delete() before freeing the driver's private
data.  This does not wait for a running byd_clear_touch() callback, which
dereferences the private data and its psmouse pointer.  A callback racing
with disconnect can therefore access the private data after it has been
freed.  The timer can also still be re-armed by byd_process_byte() while
the disconnect is in progress.

Use timer_shutdown_sync() before freeing the private data: it waits for
a running callback and turns any later re-arm attempt into a no-op.

Fixes: 2d5f5611dd0d ("Input: byd - enable absolute mode")
Cc: stable@vger.kernel.org
Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
Link: https://patch.msgid.link/20260720061259.1601281-1-lilinmao@kylinos.cn
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

diff --git a/drivers/input/mouse/byd.c b/drivers/input/mouse/byd.c
index f5770a3af2f1..5fc3c629590a 100644
--- a/drivers/input/mouse/byd.c
+++ b/drivers/input/mouse/byd.c
@@ -423,7 +423,7 @@ static void byd_disconnect(struct psmouse *psmouse)
 	struct byd_data *priv = psmouse->private;
 
 	if (priv) {
-		timer_delete(&priv->timer);
+		timer_shutdown_sync(&priv->timer);
 		kfree(psmouse->private);
 		psmouse->private = NULL;
 	}


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

* [PATCH 5.10.y] Input: byd - synchronize timer deletion before freeing private data
  2026-08-20 11:07 FAILED: patch "[PATCH] Input: byd - synchronize timer deletion before freeing" failed to apply to 5.10-stable tree gregkh
@ 2026-08-24 16:26 ` Sasha Levin
  2026-10-21 12:30   ` Miguel Gazquez
  0 siblings, 1 reply; 4+ messages in thread
From: Sasha Levin @ 2026-08-24 16:26 UTC (permalink / raw)
  To: stable; +Cc: Linmao Li, Dmitry Torokhov, Sasha Levin

From: Linmao Li <lilinmao@kylinos.cn>

[ Upstream commit c83e79c0842ed29860648bcce5022ef0ba5001c6 ]

byd_disconnect() uses timer_delete() before freeing the driver's private
data.  This does not wait for a running byd_clear_touch() callback, which
dereferences the private data and its psmouse pointer.  A callback racing
with disconnect can therefore access the private data after it has been
freed.  The timer can also still be re-armed by byd_process_byte() while
the disconnect is in progress.

Use timer_shutdown_sync() before freeing the private data: it waits for
a running callback and turns any later re-arm attempt into a no-op.

Fixes: 2d5f5611dd0d ("Input: byd - enable absolute mode")
Cc: stable@vger.kernel.org
Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
Link: https://patch.msgid.link/20260720061259.1601281-1-lilinmao@kylinos.cn
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/input/mouse/byd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/mouse/byd.c b/drivers/input/mouse/byd.c
index 6e0c5f5a2713d..1a0956520dcbe 100644
--- a/drivers/input/mouse/byd.c
+++ b/drivers/input/mouse/byd.c
@@ -426,7 +426,7 @@ static void byd_disconnect(struct psmouse *psmouse)
 	struct byd_data *priv = psmouse->private;
 
 	if (priv) {
-		del_timer(&priv->timer);
+		timer_delete_sync(&priv->timer);
 		kfree(psmouse->private);
 		psmouse->private = NULL;
 	}
-- 
2.53.0


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

* Re: [PATCH 5.10.y] Input: byd - synchronize timer deletion before freeing private data
  2026-08-24 16:26 ` [PATCH 5.10.y] Input: byd - synchronize timer deletion before freeing private data Sasha Levin
@ 2026-10-21 12:30   ` Miguel Gazquez
  2026-10-23 20:02     ` Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: Miguel Gazquez @ 2026-10-21 12:30 UTC (permalink / raw)
  To: Sasha Levin, stable; +Cc: Linmao Li, Dmitry Torokhov

Hi.

Is there a reason why this wasn't merged ?

Le 24/08/2026 à 18:26, Sasha Levin a écrit :
> From: Linmao Li <lilinmao@kylinos.cn>
> 
> [ Upstream commit c83e79c0842ed29860648bcce5022ef0ba5001c6 ]
> 
> byd_disconnect() uses timer_delete() before freeing the driver's private
> data.  This does not wait for a running byd_clear_touch() callback, which
> dereferences the private data and its psmouse pointer.  A callback racing
> with disconnect can therefore access the private data after it has been
> freed.  The timer can also still be re-armed by byd_process_byte() while
> the disconnect is in progress.
> 
> Use timer_shutdown_sync() before freeing the private data: it waits for
> a running callback and turns any later re-arm attempt into a no-op.
> 
> Fixes: 2d5f5611dd0d ("Input: byd - enable absolute mode")
> Cc: stable@vger.kernel.org
> Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
> Link: https://patch.msgid.link/20260720061259.1601281-1-lilinmao@kylinos.cn
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>   drivers/input/mouse/byd.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/mouse/byd.c b/drivers/input/mouse/byd.c
> index 6e0c5f5a2713d..1a0956520dcbe 100644
> --- a/drivers/input/mouse/byd.c
> +++ b/drivers/input/mouse/byd.c
> @@ -426,7 +426,7 @@ static void byd_disconnect(struct psmouse *psmouse)
>   	struct byd_data *priv = psmouse->private;
>   
>   	if (priv) {
> -		del_timer(&priv->timer);
> +		timer_delete_sync(&priv->timer);
>   		kfree(psmouse->private);
>   		psmouse->private = NULL;
>   	}

-- 
Miguel Gazquez, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


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

* Re: [PATCH 5.10.y] Input: byd - synchronize timer deletion before freeing private data
  2026-10-21 12:30   ` Miguel Gazquez
@ 2026-10-23 20:02     ` Sasha Levin
  0 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2026-10-23 20:02 UTC (permalink / raw)
  To: stable; +Cc: Sasha Levin, Linmao Li, Dmitry Torokhov, Miguel Gazquez

> Is there a reason why this wasn't merged ?

No, those were missed. Both are queued now for 5.15 and 5.10.

-- 
Thanks,
Sasha

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

end of thread, other threads:[~2026-10-23 20:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20 11:07 FAILED: patch "[PATCH] Input: byd - synchronize timer deletion before freeing" failed to apply to 5.10-stable tree gregkh
2026-08-24 16:26 ` [PATCH 5.10.y] Input: byd - synchronize timer deletion before freeing private data Sasha Levin
2026-10-21 12:30   ` Miguel Gazquez
2026-10-23 20:02     ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox