* [PATCH] ipv4: fix a memory leak in ic_bootp_send_if
@ 2011-11-14 7:54 roy.qing.li
2011-11-14 19:38 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: roy.qing.li @ 2011-11-14 7:54 UTC (permalink / raw)
To: netdev
From: RongQing.Li <roy.qing.li@gmail.com>
when dev_hard_header() failed, the newly allocated skb should be freed.
Signed-off-by: RongQing.Li <roy.qing.li@gmail.com>
---
net/ipv4/ipconfig.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 0da2afc..7f17ba8 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -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");
}
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ipv4: fix a memory leak in ic_bootp_send_if
2011-11-14 7:54 [PATCH] ipv4: fix a memory leak in ic_bootp_send_if roy.qing.li
@ 2011-11-14 19:38 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-11-14 19:38 UTC (permalink / raw)
To: roy.qing.li; +Cc: netdev
From: roy.qing.li@gmail.com
Date: Mon, 14 Nov 2011 15:54:08 +0800
> From: RongQing.Li <roy.qing.li@gmail.com>
>
> when dev_hard_header() failed, the newly allocated skb should be freed.
>
> Signed-off-by: RongQing.Li <roy.qing.li@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-14 19:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-14 7:54 [PATCH] ipv4: fix a memory leak in ic_bootp_send_if roy.qing.li
2011-11-14 19:38 ` David Miller
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).