aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/igmp.c
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/ipv4/igmp.c
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/ipv4/igmp.c')
-rw-r--r--net/ipv4/igmp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 6699f23e6f55..0b5580c69f2d 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -2435,6 +2435,8 @@ static int igmp_mc_seq_show(struct seq_file *seq, void *v)
2435 struct ip_mc_list *im = (struct ip_mc_list *)v; 2435 struct ip_mc_list *im = (struct ip_mc_list *)v;
2436 struct igmp_mc_iter_state *state = igmp_mc_seq_private(seq); 2436 struct igmp_mc_iter_state *state = igmp_mc_seq_private(seq);
2437 char *querier; 2437 char *querier;
2438 long delta;
2439
2438#ifdef CONFIG_IP_MULTICAST 2440#ifdef CONFIG_IP_MULTICAST
2439 querier = IGMP_V1_SEEN(state->in_dev) ? "V1" : 2441 querier = IGMP_V1_SEEN(state->in_dev) ? "V1" :
2440 IGMP_V2_SEEN(state->in_dev) ? "V2" : 2442 IGMP_V2_SEEN(state->in_dev) ? "V2" :
@@ -2448,11 +2450,12 @@ static int igmp_mc_seq_show(struct seq_file *seq, void *v)
2448 state->dev->ifindex, state->dev->name, state->in_dev->mc_count, querier); 2450 state->dev->ifindex, state->dev->name, state->in_dev->mc_count, querier);
2449 } 2451 }
2450 2452
2453 delta = im->timer.expires - jiffies;
2451 seq_printf(seq, 2454 seq_printf(seq,
2452 "\t\t\t\t%08X %5d %d:%08lX\t\t%d\n", 2455 "\t\t\t\t%08X %5d %d:%08lX\t\t%d\n",
2453 im->multiaddr, im->users, 2456 im->multiaddr, im->users,
2454 im->tm_running, im->tm_running ? 2457 im->tm_running,
2455 jiffies_to_clock_t(im->timer.expires-jiffies) : 0, 2458 im->tm_running ? jiffies_delta_to_clock_t(delta) : 0,
2456 im->reporter); 2459 im->reporter);
2457 } 2460 }
2458 return 0; 2461 return 0;