Browse Source

netfilter: CLUSTERIP: clusterip_seq_stop() fix

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

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Eric Dumazet 15 years ago
parent
commit
902a3dd5e6
1 changed files with 2 additions and 1 deletions
  1. 2 1
      net/ipv4/netfilter/ipt_CLUSTERIP.c

+ 2 - 1
net/ipv4/netfilter/ipt_CLUSTERIP.c

@@ -599,7 +599,8 @@ static void *clusterip_seq_next(struct seq_file *s, void *v, loff_t *pos)
 
 static void clusterip_seq_stop(struct seq_file *s, void *v)
 {
-	kfree(v);
+	if (!IS_ERR(v))
+		kfree(v);
 }
 
 static int clusterip_seq_show(struct seq_file *s, void *v)