Skip to content

Commit

Permalink
net: use kfree_skb_list() helper
Browse files Browse the repository at this point in the history
We can use kfree_skb_list() instead of open coding it.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Dec 22, 2013
1 parent 1b6176c commit 289dccb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
18 changes: 3 additions & 15 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2454,13 +2454,8 @@ static void dev_gso_skb_destructor(struct sk_buff *skb)
{
struct dev_gso_cb *cb;

do {
struct sk_buff *nskb = skb->next;

skb->next = nskb->next;
nskb->next = NULL;
kfree_skb(nskb);
} while (skb->next);
kfree_skb_list(skb->next);
skb->next = NULL;

cb = DEV_GSO_CB(skb);
if (cb->destructor)
Expand Down Expand Up @@ -4240,17 +4235,10 @@ EXPORT_SYMBOL(netif_napi_add);

void netif_napi_del(struct napi_struct *napi)
{
struct sk_buff *skb, *next;

list_del_init(&napi->dev_list);
napi_free_frags(napi);

for (skb = napi->gro_list; skb; skb = next) {
next = skb->next;
skb->next = NULL;
kfree_skb(skb);
}

kfree_skb_list(napi->gro_list);
napi->gro_list = NULL;
napi->gro_count = 0;
}
Expand Down
5 changes: 1 addition & 4 deletions net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -2981,10 +2981,7 @@ struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features)
return segs;

err:
while ((skb = segs)) {
segs = skb->next;
kfree_skb(skb);
}
kfree_skb_list(segs);
return ERR_PTR(err);
}
EXPORT_SYMBOL_GPL(skb_segment);
Expand Down

0 comments on commit 289dccb

Please sign in to comment.