lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20241202124220.87481-1-guille.rodriguez@gmail.com>
Date: Mon,  2 Dec 2024 13:42:20 +0100
From: Guillermo Rodríguez <guille.rodriguez@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Guillermo Rodríguez <guille.rodriguez@...il.com>,
	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	linux-input@...r.kernel.org
Subject: [PATCH 1/1] Input: evdev - fix wrong timestamp after SYN_DROPPED event

Reset the input device's timestamp after generating a SYN_DROPPED
event, otherwise the next real event will use the same timestamp as
the SYN_DROPPED event itself.

Fixes: 3b51c44bd693 ("Input: allow drivers specify timestamp for input events")

Signed-off-by: Guillermo Rodríguez <guille.rodriguez@...il.com>
---
 drivers/input/evdev.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index b5cbb57ee5f6..6ab38a611321 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -142,7 +142,8 @@ static void __evdev_flush_queue(struct evdev_client *client, unsigned int type)
 
 static void __evdev_queue_syn_dropped(struct evdev_client *client)
 {
-	ktime_t *ev_time = input_get_timestamp(client->evdev->handle.dev);
+	struct input_dev *input_dev = client->evdev->handle.dev;
+	ktime_t *ev_time = input_get_timestamp(input_dev);
 	struct timespec64 ts = ktime_to_timespec64(ev_time[client->clk_type]);
 	struct input_event ev;
 
@@ -160,6 +161,13 @@ static void __evdev_queue_syn_dropped(struct evdev_client *client)
 		client->tail = (client->head - 1) & (client->bufsize - 1);
 		client->packet_head = client->tail;
 	}
+
+	/*
+	 * Reset the timestamp; otherwise the next event will
+	 * have the same timestamp as this SYN_DROPPED event.
+	 * See input_handle_event.
+	 */
+	input_dev->timestamp[INPUT_CLK_MONO] = ktime_set(0, 0);
 }
 
 static void evdev_queue_syn_dropped(struct evdev_client *client)
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ