netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xt_hashlimit: dl_seq_stop() fix
@ 2010-03-24 20:47 Eric Dumazet
  2010-03-25 10:01 ` Patrick McHardy
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2010-03-24 20:47 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: David Miller, netdev, Netfilter Development Mailinglist

If dl_seq_start() memory allocation fails, we crash later in
dl_seq_stop(), trying to kfree(ERR_PTR(-ENOMEM))

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 9e9c489..70d561a 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -879,7 +879,8 @@ static void dl_seq_stop(struct seq_file *s, void *v)
 	struct xt_hashlimit_htable *htable = s->private;
 	unsigned int *bucket = (unsigned int *)v;
 
-	kfree(bucket);
+	if (!IS_ERR(bucket))
+		kfree(bucket);
 	spin_unlock_bh(&htable->lock);
 }
 



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

end of thread, other threads:[~2010-03-25 10:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-24 20:47 [PATCH] xt_hashlimit: dl_seq_stop() fix Eric Dumazet
2010-03-25 10:01 ` Patrick McHardy
2010-03-25 10:07   ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).