Skip to content

Commit 581fe0e

Browse files
wdebruijdavem330
authored andcommitted
net: orphan frags on stand-alone ptype in dev_queue_xmit_nit
Zerocopy skbs frags are copied when the skb is looped to a local sock. Commit 1080e51 ("net: orphan frags on receive") introduced calls to skb_orphan_frags to deliver_skb and __netif_receive_skb for this. With msg_zerocopy, these skbs can also exist in the tx path and thus loop from dev_queue_xmit_nit. This already calls deliver_skb in its loop. But it does not orphan before a separate pt_prev->func(). Add the missing skb_orphan_frags_rx. Changes v1->v2: handle skb_orphan_frags_rx failure Fixes: 1f8b977 ("sock: enable MSG_ZEROCOPY") Signed-off-by: Willem de Bruijn <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b9b95da commit 581fe0e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

net/core/dev.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,8 +1948,12 @@ void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
19481948
goto again;
19491949
}
19501950
out_unlock:
1951-
if (pt_prev)
1952-
pt_prev->func(skb2, skb->dev, pt_prev, skb->dev);
1951+
if (pt_prev) {
1952+
if (!skb_orphan_frags_rx(skb2, GFP_ATOMIC))
1953+
pt_prev->func(skb2, skb->dev, pt_prev, skb->dev);
1954+
else
1955+
kfree_skb(skb2);
1956+
}
19531957
rcu_read_unlock();
19541958
}
19551959
EXPORT_SYMBOL_GPL(dev_queue_xmit_nit);

0 commit comments

Comments
 (0)