Commit 01dc4769 authored by François Romieu's avatar François Romieu Committed by David S. Miller

[NETFILTER]: Fix leaks in error paths of ip_recent_ctrl.

parent 8125d6bc
...@@ -300,9 +300,15 @@ static int ip_recent_ctrl(struct file *file, const char *input, unsigned long si ...@@ -300,9 +300,15 @@ static int ip_recent_ctrl(struct file *file, const char *input, unsigned long si
info->name[IPT_RECENT_NAME_LEN-1] = '\0'; info->name[IPT_RECENT_NAME_LEN-1] = '\0';
skb = kmalloc(sizeof(struct sk_buff),GFP_KERNEL); skb = kmalloc(sizeof(struct sk_buff),GFP_KERNEL);
if(!skb) { return -ENOMEM; } if (!skb) {
used = -ENOMEM;
goto out_free_info;
}
skb->nh.iph = kmalloc(sizeof(struct iphdr),GFP_KERNEL); skb->nh.iph = kmalloc(sizeof(struct iphdr),GFP_KERNEL);
if(!skb->nh.iph) { return -ENOMEM; } if (!skb->nh.iph) {
used = -ENOMEM;
goto out_free_skb;
}
skb->nh.iph->saddr = addr; skb->nh.iph->saddr = addr;
skb->nh.iph->daddr = 0; skb->nh.iph->daddr = 0;
...@@ -311,7 +317,9 @@ static int ip_recent_ctrl(struct file *file, const char *input, unsigned long si ...@@ -311,7 +317,9 @@ static int ip_recent_ctrl(struct file *file, const char *input, unsigned long si
match(skb,NULL,NULL,info,0,NULL); match(skb,NULL,NULL,info,0,NULL);
kfree(skb->nh.iph); kfree(skb->nh.iph);
out_free_skb:
kfree(skb); kfree(skb);
out_free_info:
kfree(info); kfree(info);
#ifdef DEBUG #ifdef DEBUG
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment