2008-01-16 23:45:55

by Stefano Brivio

[permalink] [raw]
Subject: rc80211-pid: fix last_sample initialization

Fix last_sample initialization. kzalloc'ing the per-STA data wasn't enough,
as jiffies can assume negative values as well. This fixes a bug which
prevented correct PID operation for a while after booting.

Thanks to Michael Buesch for reporting this.

Reported-and-tested-by: Michael Buesch <[email protected]>
Signed-off-by: Stefano Brivio <[email protected]>
---
Index: wireless-2.6/net/mac80211/rc80211_pid_algo.c
===================================================================
--- wireless-2.6.orig/net/mac80211/rc80211_pid_algo.c
+++ wireless-2.6/net/mac80211/rc80211_pid_algo.c
@@ -496,6 +496,8 @@ static void *rate_control_pid_alloc_sta(
if (spinfo == NULL)
return NULL;

+ spinfo->last_sample = jiffies;
+
#ifdef CONFIG_MAC80211_DEBUGFS
spin_lock_init(&spinfo->events.lock);
init_waitqueue_head(&spinfo->events.waitqueue);


--
Ciao
Stefano


2008-01-16 23:49:36

by Mattias Nissler

[permalink] [raw]
Subject: Re: rc80211-pid: fix last_sample initialization


On Thu, 2008-01-17 at 00:38 +0100, Stefano Brivio wrote:
> Fix last_sample initialization. kzalloc'ing the per-STA data wasn't enough,
> as jiffies can assume negative values as well. This fixes a bug which
> prevented correct PID operation for a while after booting.
>
> Thanks to Michael Buesch for reporting this.
>
> Reported-and-tested-by: Michael Buesch <[email protected]>
> Signed-off-by: Stefano Brivio <[email protected]>

Ack.

> ---
> Index: wireless-2.6/net/mac80211/rc80211_pid_algo.c
> ===================================================================
> --- wireless-2.6.orig/net/mac80211/rc80211_pid_algo.c
> +++ wireless-2.6/net/mac80211/rc80211_pid_algo.c
> @@ -496,6 +496,8 @@ static void *rate_control_pid_alloc_sta(
> if (spinfo == NULL)
> return NULL;
>
> + spinfo->last_sample = jiffies;
> +
> #ifdef CONFIG_MAC80211_DEBUGFS
> spin_lock_init(&spinfo->events.lock);
> init_waitqueue_head(&spinfo->events.waitqueue);
>
>