netfilter: xt_hashlimit: dl_seq_stop() fix

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, March 26, 2010 - 9:59 am

Gitweb:     http://git.kernel.org/linus/55e0d7cf279177dfe320f54816320558bc370f24
Commit:     55e0d7cf279177dfe320f54816320558bc370f24
Parent:     ef1691504c83ba3eb636c0cfd3ed33f7a6d0b4ee
Author:     Eric Dumazet <eric.dumazet@gmail.com>
AuthorDate: Thu Mar 25 11:00:22 2010 +0100
Committer:  Patrick McHardy <kaber@trash.net>
CommitDate: Thu Mar 25 11:00:22 2010 +0100

    netfilter: xt_hashlimit: dl_seq_stop() fix
    
    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>
    Signed-off-by: Patrick McHardy <kaber@trash.net>
---
 net/netfilter/xt_hashlimit.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

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);
 }
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
netfilter: xt_hashlimit: dl_seq_stop() fix, Linux Kernel Mailing ..., (Fri Mar 26, 9:59 am)