linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Shouldn't we be using alloc_skb/kfree_skb in net/ipv4/netfilter/ipt_recent.c::ip_recent_ctrl ?
@ 2005-06-16 22:36 Jesper Juhl
  2005-06-16 22:33 ` Stephen Frost
  2005-06-16 22:48 ` David S. Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Jesper Juhl @ 2005-06-16 22:36 UTC (permalink / raw)
  To: LKML; +Cc: laforge, Stephen Frost, Jesper Juhl, Jesper Juhl

I was just grep'ing through the source looking for places where skb's 
might be freed by plain kfree() and, amongst other things, I noticed 
net/ipv4/netfilter/ipt_recent.c::ip_recent_ctrl, where a struct sk_buff* 
is defined and then storage for it is allocated with kmalloc() and freed 
with kfree(), and I'm wondering if we shouldn't be using 
alloc_skb/kfree_skb instead (as pr the patch below)? Or is there some good 
reason for doing it the way it's currently done?


Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
---

 net/ipv4/netfilter/ipt_recent.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

--- linux-2.6.12-rc6-mm1-orig/net/ipv4/netfilter/ipt_recent.c	2005-06-12 15:58:58.000000000 +0200
+++ linux-2.6.12-rc6-mm1/net/ipv4/netfilter/ipt_recent.c	2005-06-16 23:41:55.000000000 +0200
@@ -303,7 +303,7 @@ static int ip_recent_ctrl(struct file *f
 	strncpy(info->name,curr_table->name,IPT_RECENT_NAME_LEN);
 	info->name[IPT_RECENT_NAME_LEN-1] = '\0';
 
-	skb = kmalloc(sizeof(struct sk_buff),GFP_KERNEL);
+	skb = alloc_skb(sizeof(struct sk_buff),GFP_KERNEL);
 	if (!skb) {
 		used = -ENOMEM;
 		goto out_free_info;
@@ -322,7 +322,7 @@ static int ip_recent_ctrl(struct file *f
 
 	kfree(skb->nh.iph);
 out_free_skb:
-	kfree(skb);
+	kfree_skb(skb);
 out_free_info:
 	kfree(info);
 



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-06-17  2:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-16 22:36 Shouldn't we be using alloc_skb/kfree_skb in net/ipv4/netfilter/ipt_recent.c::ip_recent_ctrl ? Jesper Juhl
2005-06-16 22:33 ` Stephen Frost
2005-06-16 22:48 ` David S. Miller
2005-06-16 22:53   ` Jesper Juhl
2005-06-17  2:31   ` Stephen Frost

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).