Commit 5643a552d31242e5adf3dbefba26c90b1bce2826

Authored by Jason A. Donenfeld
Committed by David S. Miller
1 parent dcfea72e79

net: tap: use skb_list_walk_safe helper for gso segments

This is a straight-forward conversion case for the new function, and
while we're at it, we can remove a null write to skb->next by replacing
it with skb_mark_not_on_list.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 6 additions and 8 deletions Side-by-side Diff

... ... @@ -341,6 +341,7 @@
341 341 features |= tap->tap_features;
342 342 if (netif_needs_gso(skb, features)) {
343 343 struct sk_buff *segs = __skb_gso_segment(skb, features, false);
  344 + struct sk_buff *next;
344 345  
345 346 if (IS_ERR(segs))
346 347 goto drop;
347 348  
... ... @@ -352,16 +353,13 @@
352 353 }
353 354  
354 355 consume_skb(skb);
355   - while (segs) {
356   - struct sk_buff *nskb = segs->next;
357   -
358   - segs->next = NULL;
359   - if (ptr_ring_produce(&q->ring, segs)) {
360   - kfree_skb(segs);
361   - kfree_skb_list(nskb);
  356 + skb_list_walk_safe(segs, skb, next) {
  357 + skb_mark_not_on_list(skb);
  358 + if (ptr_ring_produce(&q->ring, skb)) {
  359 + kfree_skb(skb);
  360 + kfree_skb_list(next);
362 361 break;
363 362 }
364   - segs = nskb;
365 363 }
366 364 } else {
367 365 /* If we receive a partial checksum and the tap side