All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Input: byd - synchronize timer deletion before freeing private data
@ 2026-07-20  3:30 Linmao Li
  2026-07-20  3:48 ` sashiko-bot
  2026-07-20  6:12 ` [PATCH v2] " Linmao Li
  0 siblings, 2 replies; 5+ messages in thread
From: Linmao Li @ 2026-07-20  3:30 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Kees Cook, Vivek BalachandharTN, Richard Pospesel, Chris Diamand,
	linux-input, linux-kernel, Linmao Li, stable

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.

Use timer_delete_sync() to wait for any running callback before releasing
the private data.

Fixes: 2d5f5611dd0d ("Input: byd - enable absolute mode")
Cc: stable@vger.kernel.org
Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
---
 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 f5770a3af2f1..7a69724c1ac6 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_delete_sync(&priv->timer);
 		kfree(psmouse->private);
 		psmouse->private = NULL;
 	}
-- 
2.25.1


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

end of thread, other threads:[~2026-07-20  6:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-20  3:30 [PATCH] Input: byd - synchronize timer deletion before freeing private data Linmao Li
2026-07-20  3:48 ` sashiko-bot
2026-07-20  5:18   ` Dmitry Torokhov
2026-07-20  6:12 ` [PATCH v2] " Linmao Li
2026-07-20  6:26   ` sashiko-bot

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.