All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipt_hashlimit.c: expire's type overflow when showing tuples at bad moment.
@ 2005-01-23  1:32 Samuel Jean
  2005-02-01 13:29 ` Harald Welte
  0 siblings, 1 reply; 9+ messages in thread
From: Samuel Jean @ 2005-01-23  1:32 UTC (permalink / raw)
  To: Harald Welte; +Cc: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 481 bytes --]

Name: Expire's type overflow when showing tuples at bad moment.
Status: Tested under Linux 2.6.6 uml patched.
Signed-off-by: Samuel Jean <sjean@cookinglinux.org>

When garbage collector runs slow enough, we have a chance to print
expired tuples before they get freed. We see weird expiry time.

Not sure if I needed 'now' reference so I didn't took chance.

Index: linux-2.6.6/net/ipv4/netfilter/ipt_hashlimit.c
===================================================================


[-- Attachment #2: ipt_hashlimit.c-proc_show.patch --]
[-- Type: text/x-patch, Size: 840 bytes --]

--- net/ipv4/netfilter/ipt_hashlimit.c.orig	2005-01-22 19:48:05.000000000 -0500
+++ net/ipv4/netfilter/ipt_hashlimit.c	2005-01-22 19:50:44.000000000 -0500
@@ -605,11 +605,12 @@ static void dl_seq_stop(struct seq_file 
 
 static inline int dl_seq_real_show(struct dsthash_ent *ent, struct seq_file *s)
 {
+	unsigned int now = jiffies;
 	/* recalculate to show accurate numbers */
-	rateinfo_recalc(ent, jiffies);
+	rateinfo_recalc(ent, now);
 
-	return seq_printf(s, "%ld %u.%u.%u.%u:%u->%u.%u.%u.%u:%u %u %u %u\n",
-			(ent->expires - jiffies)/HZ,
+	return seq_printf(s, "%lu %u.%u.%u.%u:%u->%u.%u.%u.%u:%u %u %u %u\n",
+			(ent->expires > now) ? (ent->expires - now)/HZ : 0,
 			NIPQUAD(ent->dst.src_ip), ntohs(ent->dst.src_port),
 			NIPQUAD(ent->dst.dst_ip), ntohs(ent->dst.dst_port),
 			ent->rateinfo.credit, ent->rateinfo.credit_cap,

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-02-02  2:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-23  1:32 [PATCH] ipt_hashlimit.c: expire's type overflow when showing tuples at bad moment Samuel Jean
2005-02-01 13:29 ` Harald Welte
2005-02-01 13:43   ` Patrick McHardy
2005-02-01 13:54     ` Harald Welte
2005-02-01 14:20       ` Patrick McHardy
2005-02-01 14:53         ` Samuel Jean
2005-02-01 18:16           ` Patrick McHardy
2005-02-01 21:47             ` Samuel Jean
2005-02-02  2:11               ` Patrick McHardy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.