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-next>] [day] [month] [year] [list]
Message-Id: <1440574712-25629-1-git-send-email-hans.holmberg@intel.com>
Date:	Wed, 26 Aug 2015 09:38:32 +0200
From:	Hans Holmberg <hans.holmberg@...el.com>
To:	dmitry.torokhov@...il.com
Cc:	ting.li@...el.com, linux-input@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Hans Holmberg <hans.holmberg@...el.com>
Subject: [PATCH] Input: only send a syn event when needed in input_dev_release_keys

A SYN event is reported in input_release_keys even if no keys are
released. Stop doing this as the superfluous event can prevent autosleep
if a user has opened a device with EPOLLWAKEUP enabled.

Based on a patch developed by Ting Li <ting.li@...el.com>.

Signed-off-by: Hans Holmberg <hans.holmberg@...el.com>
---
 drivers/input/input.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 78d2499..c748805 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -675,12 +675,18 @@ EXPORT_SYMBOL(input_close_device);
 static void input_dev_release_keys(struct input_dev *dev)
 {
 	int code;
+	bool key_released = false;
 
 	if (is_event_supported(EV_KEY, dev->evbit, EV_MAX)) {
-		for_each_set_bit(code, dev->key, KEY_CNT)
+		for_each_set_bit(code, dev->key, KEY_CNT) {
 			input_pass_event(dev, EV_KEY, code, 0);
-		memset(dev->key, 0, sizeof(dev->key));
-		input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
+			key_released = true;
+		}
+
+		if (key_released) {
+			memset(dev->key, 0, sizeof(dev->key));
+			input_pass_event(dev, EV_SYN, SYN_REPORT, 1);
+		}
 	}
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ