aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-08-08 17:13:53 -0400
committerDavid S. Miller <davem@davemloft.net>2012-08-09 19:17:03 -0400
commita399a8053164ec8bcb06fed52be9941a26ecde11 (patch)
treec60402a77d08c82630d63e972d32b038919b827f /net/bridge
parent79cda75a107da0d49732b5cb642b456264dd7e0e (diff)
time: jiffies_delta_to_clock_t() helper to the rescue
Various /proc/net files sometimes report crazy timer values, expressed in clock_t units. This happens when an expired timer delta (expires - jiffies) is passed to jiffies_to_clock_t(). This function has an overflow in : return div_u64((u64)x * TICK_NSEC, NSEC_PER_SEC / USER_HZ); commit cbbc719fccdb8cb (time: Change jiffies_to_clock_t() argument type to unsigned long) only got around the problem. As we cant output negative values in /proc/net/tcp without breaking various tools, I suggest adding a jiffies_delta_to_clock_t() wrapper that caps the negative delta to a 0 value. Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: Maciej Żenczykowski <maze@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: hank <pyu@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/br_fdb.c2
-rw-r--r--net/bridge/br_stp_timer.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index d21f32383517..9ce430b4657c 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -312,7 +312,7 @@ int br_fdb_fillbuf(struct net_bridge *br, void *buf,
312 312
313 fe->is_local = f->is_local; 313 fe->is_local = f->is_local;
314 if (!f->is_static) 314 if (!f->is_static)
315 fe->ageing_timer_value = jiffies_to_clock_t(jiffies - f->updated); 315 fe->ageing_timer_value = jiffies_delta_to_clock_t(jiffies - f->updated);
316 ++fe; 316 ++fe;
317 ++num; 317 ++num;
318 } 318 }
diff --git a/net/bridge/br_stp_timer.c b/net/bridge/br_stp_timer.c
index a6747e673426..c3530a81a33b 100644
--- a/net/bridge/br_stp_timer.c
+++ b/net/bridge/br_stp_timer.c
@@ -170,5 +170,5 @@ void br_stp_port_timer_init(struct net_bridge_port *p)
170unsigned long br_timer_value(const struct timer_list *timer) 170unsigned long br_timer_value(const struct timer_list *timer)
171{ 171{
172 return timer_pending(timer) 172 return timer_pending(timer)
173 ? jiffies_to_clock_t(timer->expires - jiffies) : 0; 173 ? jiffies_delta_to_clock_t(timer->expires - jiffies) : 0;
174} 174}