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 16:31:03 +0200
From:	Ivo van Doorn <ivdoorn@...il.com>
To:	Matthew Garrett <mjg59@...f.ucam.org>
Cc:	dmitry.torokhov@...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

On Sunday 05 October 2008, 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 am not too happy about the multiple jiffies - HZ/5 statements
regardless of the comment that it should be updated when new tasks are
defined.

But on the other hand I haven't seen any real alternatives yet either,
so I have no objections against this patch either.

Acked-by: Ivo van Doorn <IvDoorn@...il.com>
 
> ---
> 
> Document the requirement to initialise the struct.
> 
> diff --git a/net/rfkill/rfkill-input.c b/net/rfkill/rfkill-input.c
> index e5b6955..6c7baa0 100644
> --- a/net/rfkill/rfkill-input.c
> +++ b/net/rfkill/rfkill-input.c
> @@ -103,6 +103,8 @@ static void rfkill_schedule_toggle(struct rfkill_task *task)
>  		.desired_state = RFKILL_STATE_UNBLOCKED,	\
>  	}
>  
> +/* Remember to initialise these in rfkill_handler_init if you add any */
> +
>  static DEFINE_RFKILL_TASK(rfkill_wlan, RFKILL_TYPE_WLAN);
>  static DEFINE_RFKILL_TASK(rfkill_bt, RFKILL_TYPE_BLUETOOTH);
>  static DEFINE_RFKILL_TASK(rfkill_uwb, RFKILL_TYPE_UWB);
> @@ -255,6 +257,11 @@ static struct input_handler rfkill_handler = {
>  
>  static int __init rfkill_handler_init(void)
>  {
> +	rfkill_wlan.last = jiffies - HZ/5;
> +	rfkill_bt.last = jiffies - HZ/5;
> +	rfkill_uwb.last = jiffies - HZ/5;
> +	rfkill_wimax.last = jiffies - HZ/5;
> +	rfkill_wwan.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