Skip to content

Commit 84b2052

Browse files
Linmao Ligregkh
authored andcommitted
Input: byd - synchronize timer deletion before freeing private data
[ Upstream commit c83e79c ] 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: 2d5f561 ("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> [ changed `del_timer()` to `timer_shutdown_sync()` since 6.12 predates the `del_timer()` → `timer_delete()` rename ] Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e7077e6 commit 84b2052

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/input/mouse/byd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ static void byd_disconnect(struct psmouse *psmouse)
426426
struct byd_data *priv = psmouse->private;
427427

428428
if (priv) {
429-
del_timer(&priv->timer);
429+
timer_shutdown_sync(&priv->timer);
430430
kfree(psmouse->private);
431431
psmouse->private = NULL;
432432
}

0 commit comments

Comments
 (0)