net: netfilter: use skb_list_walk_safe helper for gso segments
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 13 Jan 2020 23:42:32 +0000 (18:42 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Jan 2020 19:48:41 +0000 (11:48 -0800)
This is a straight-forward conversion case for the new function, keeping
the flow of the existing code as intact as possible.

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

index feabdfb22920b22d3e52a4d43ac960acca0db34c..76535fd9278c8897950c0b7180501ebb2ef7f15c 100644 (file)
@@ -778,7 +778,7 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum)
 {
        unsigned int queued;
        struct nfqnl_instance *queue;
-       struct sk_buff *skb, *segs;
+       struct sk_buff *skb, *segs, *nskb;
        int err = -ENOBUFS;
        struct net *net = entry->state.net;
        struct nfnl_queue_net *q = nfnl_queue_pernet(net);
@@ -815,8 +815,7 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum)
                goto out_err;
        queued = 0;
        err = 0;
-       do {
-               struct sk_buff *nskb = segs->next;
+       skb_list_walk_safe(segs, segs, nskb) {
                if (err == 0)
                        err = __nfqnl_enqueue_packet_gso(net, queue,
                                                        segs, entry);
@@ -824,8 +823,7 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum)
                        queued++;
                else
                        kfree_skb(segs);
-               segs = nskb;
-       } while (segs);
+       }
 
        if (queued) {
                if (err) /* some segments are already queued */