Skip to content

Commit

Permalink
ipv4: fix a memory leak in ic_bootp_send_if
Browse files Browse the repository at this point in the history
when dev_hard_header() failed, the newly allocated skb should be freed.

Signed-off-by: RongQing.Li <roy.qing.li@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
RongQing.Li authored and David S. Miller committed Nov 14, 2011
1 parent 5219e4c commit ad79eef
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions net/ipv4/ipconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -822,8 +822,13 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d
skb->dev = dev;
skb->protocol = htons(ETH_P_IP);
if (dev_hard_header(skb, dev, ntohs(skb->protocol),
dev->broadcast, dev->dev_addr, skb->len) < 0 ||
dev_queue_xmit(skb) < 0)
dev->broadcast, dev->dev_addr, skb->len) < 0) {
kfree_skb(skb);
printk("E");
return;
}

if (dev_queue_xmit(skb) < 0)
printk("E");
}

Expand Down

0 comments on commit ad79eef

Please sign in to comment.