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] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 5 Oct 2008 17:24:39 -0400
From:	Dmitry Torokhov <dmitry.torokhov@...il.com>
To:	Matthew Garrett <mjg59@...f.ucam.org>
Cc:	IvDoorn@...il.com, hmh@....eng.br, sitsofe@...oo.com,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] rfkill-input doesn't work until 5 minutes after boot

Hi Matthew,

On Sun, Oct 05, 2008 at 12:02:26PM +0100, Matthew Garrett wrote:
> rfkill-input implements debounce as follows:
> 
>         if (time_after(jiffies, task->last + msecs_to_jiffies(200))) {
> 
> However, task->last is initialised to 0 while jiffies starts at -300*HZ. 
> Any input within 5 minutes of kernel start is therefore ignored. Fix by 
> initialising task->last correctly.
> 
> Signed-off-by: Matthew Garrett <mjg@...hat.com>
> 

I'd rather have something like below. It should probably go through
David's (networking) tree. since it is in net/.

-- 
Dmitry

Input: rfkill-input doesn't work until 5 minutes after boot

From: Matthew Garrett <mjg59@...f.ucam.org>

rfkill-input implements debounce as follows:

        if (time_after(jiffies, task->last + msecs_to_jiffies(200))) {

However, task->last is initialised to 0 while jiffies starts at -300*HZ.
Any input within 5 minutes of kernel start is therefore ignored. Fix by
initialising task->last at module load.

Signed-off-by: Matthew Garrett <mjg@...hat.com>
Signed-off-by: Dmitry Torokhov <dtor@...l.ru>
---

 net/rfkill/rfkill-input.c |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)


diff --git a/net/rfkill/rfkill-input.c b/net/rfkill/rfkill-input.c
index e5b6955..775c6ba 100644
--- a/net/rfkill/rfkill-input.c
+++ b/net/rfkill/rfkill-input.c
@@ -109,21 +109,24 @@ static DEFINE_RFKILL_TASK(rfkill_uwb, RFKILL_TYPE_UWB);
 static DEFINE_RFKILL_TASK(rfkill_wimax, RFKILL_TYPE_WIMAX);
 static DEFINE_RFKILL_TASK(rfkill_wwan, RFKILL_TYPE_WWAN);
 
+static struct rfkill_task *rfkill_tasks[] = {
+	&rfkill_wlan,
+	&rfkill_bt,
+	&rfkill_uwb,
+	&rfkill_wimax,
+	&rfkill_wwan,
+};
+
 static void rfkill_schedule_evsw_rfkillall(int state)
 {
+	int i;
+
 	/* EVERY radio type. state != 0 means radios ON */
 	/* handle EPO (emergency power off) through shortcut */
 	if (state) {
-		rfkill_schedule_set(&rfkill_wwan,
-				    RFKILL_STATE_UNBLOCKED);
-		rfkill_schedule_set(&rfkill_wimax,
-				    RFKILL_STATE_UNBLOCKED);
-		rfkill_schedule_set(&rfkill_uwb,
-				    RFKILL_STATE_UNBLOCKED);
-		rfkill_schedule_set(&rfkill_bt,
-				    RFKILL_STATE_UNBLOCKED);
-		rfkill_schedule_set(&rfkill_wlan,
-				    RFKILL_STATE_UNBLOCKED);
+		for (i = 0; i < ARRAY_SIZE(rfkill_tasks); i++)
+			rfkill_schedule_set(rfkill_tasks[i],
+					    RFKILL_STATE_UNBLOCKED);
 	} else
 		rfkill_schedule_epo();
 }
@@ -255,6 +258,11 @@ static struct input_handler rfkill_handler = {
 
 static int __init rfkill_handler_init(void)
 {
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(rfkill_tasks); i++)
+		rfkill_tasks[i]->last = jiffies - HZ / 5;
+
 	return input_register_handler(&rfkill_handler);
 }
 
--
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