Shouldn't we be using alloc_skb/kfree_skb innet/ipv4/netfilter/ipt_recent.c::ip_recent_ctrl ?

From: Jesper Juhl
Date: Thu Jun 16 2005 - 17:31:46 EST


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@xxxxxx>
---

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



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/