Input:Flush client events after clk_type change
Subsystems (2)
PATCH 1/1 Input:Flush client events after clk_type change
From: Anshul Garg <[email protected]>
Since the client clk_type is changed , flush pending events from client buffer and queue SYN_DROPPED event. Added check for duplicate clk_type change request.
Signed-off-by Anshul Garg <[email protected]>
--- drivers/input/evdev.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/input/evdev.c +8 -1
@@ -64,6 +64,9 @@ struct evdev_client {static int evdev_set_clk_type (struct evdev_client *client,unsigned int clkid) { +if (client->clk_type == clkid) +return 0 ; +switch (clkid) {case CLOCK_REALTIME :
@@ -78,7 +81,11 @@ static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid)default :return -EINVAL ; } - + +/* Flush clients events after clk_type is changed +* and queue SYN_DROPPED event.*/ + client->packet_head = client->head = client->tail; +evdev_queue_syn_dropped (client);return 0 ; }
Signature · 6 lines
1.7.9.5 --- This email has been checked for viruses by Avast antivirus software. http://www.avast.com
Dmitry Torokhov
maintainerQuoted 26 lines · Anshul Garg
From: Anshul Garg <[email protected]>
Since the client
clk_typeis changed , flush pending events from client buffer and queueSYN_DROPPEDevent. Added check for duplicateclk_typechange request.Signed-off-by Anshul Garg <[email protected]>--- drivers/input/evdev.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)drivers/input/evdev.c +3
-0@@ -64,6 +64,9 @@ struct evdev_client {static int evdev_set_clk_type (struct evdev_client *client,unsigned int clkid) { +if (client->clk_type == clkid) +return 0 ; +switch (clkid) {case CLOCK_REALTIME :
drivers/input/evdev.c static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid) · line 88
Quoted 9 lines
drivers/input/evdev.c +5
-1@@ -78,7 +81,11 @@ static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid)default :return -EINVAL ; } - + +/* Flush clients events after clk_type is changed +* and queue SYN_DROPPED event.*/ + client->packet_head = client->head = client->tail; +evdev_queue_syn_dropped (client);
I am fairly certain this is racy wrt the new events coming from the device.
Thanks.
Signature · 1 line
Dmitry