* [PATCH net] net: orphan frags on stand-alone ptype in dev_queue_xmit_nit
@ 2017-09-22 22:51 Willem de Bruijn
2017-09-22 23:04 ` Eric Dumazet
0 siblings, 1 reply; 3+ messages in thread
From: Willem de Bruijn @ 2017-09-22 22:51 UTC (permalink / raw)
To: netdev; +Cc: davem, Willem de Bruijn
Zerocopy skbs frags are copied when the skb is looped to a local sock.
Commit 1080e512d44d ("net: orphan frags on receive") introduced calls
to skb_orphan_frags to deliver_skb and __netif_receive_skb.
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.
Fixes: 1f8b977ab32d ("sock: enable MSG_ZEROCOPY")
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
net/core/dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 9a2254f9802f..3f5b26ff4f74 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1948,7 +1948,7 @@ void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
goto again;
}
out_unlock:
- if (pt_prev)
+ if (pt_prev && !skb_orphan_frags_rx(skb2, GFP_ATOMIC))
pt_prev->func(skb2, skb->dev, pt_prev, skb->dev);
rcu_read_unlock();
}
--
2.14.1.821.g8fa685d3b7-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net] net: orphan frags on stand-alone ptype in dev_queue_xmit_nit
2017-09-22 22:51 [PATCH net] net: orphan frags on stand-alone ptype in dev_queue_xmit_nit Willem de Bruijn
@ 2017-09-22 23:04 ` Eric Dumazet
2017-09-22 23:15 ` Willem de Bruijn
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2017-09-22 23:04 UTC (permalink / raw)
To: Willem de Bruijn; +Cc: netdev, davem
On Fri, 2017-09-22 at 18:51 -0400, Willem de Bruijn wrote:
> Zerocopy skbs frags are copied when the skb is looped to a local sock.
> Commit 1080e512d44d ("net: orphan frags on receive") introduced calls
> to skb_orphan_frags to deliver_skb and __netif_receive_skb.
>
> 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.
>
> Fixes: 1f8b977ab32d ("sock: enable MSG_ZEROCOPY")
> Signed-off-by: Willem de Bruijn <willemb@google.com>
> ---
> net/core/dev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 9a2254f9802f..3f5b26ff4f74 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1948,7 +1948,7 @@ void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
> goto again;
> }
> out_unlock:
> - if (pt_prev)
> + if (pt_prev && !skb_orphan_frags_rx(skb2, GFP_ATOMIC))
> pt_prev->func(skb2, skb->dev, pt_prev, skb->dev);
Don't you need to kfree_skb(skb2) in case of failure ?
> rcu_read_unlock();
> }
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] net: orphan frags on stand-alone ptype in dev_queue_xmit_nit
2017-09-22 23:04 ` Eric Dumazet
@ 2017-09-22 23:15 ` Willem de Bruijn
0 siblings, 0 replies; 3+ messages in thread
From: Willem de Bruijn @ 2017-09-22 23:15 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Willem de Bruijn, Network Development, David Miller
On Fri, Sep 22, 2017 at 7:04 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Fri, 2017-09-22 at 18:51 -0400, Willem de Bruijn wrote:
>> Zerocopy skbs frags are copied when the skb is looped to a local sock.
>> Commit 1080e512d44d ("net: orphan frags on receive") introduced calls
>> to skb_orphan_frags to deliver_skb and __netif_receive_skb.
>>
>> 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.
>>
>> Fixes: 1f8b977ab32d ("sock: enable MSG_ZEROCOPY")
>> Signed-off-by: Willem de Bruijn <willemb@google.com>
>> ---
>> net/core/dev.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index 9a2254f9802f..3f5b26ff4f74 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -1948,7 +1948,7 @@ void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
>> goto again;
>> }
>> out_unlock:
>> - if (pt_prev)
>> + if (pt_prev && !skb_orphan_frags_rx(skb2, GFP_ATOMIC))
>> pt_prev->func(skb2, skb->dev, pt_prev, skb->dev);
>
> Don't you need to kfree_skb(skb2) in case of failure ?
Oh, yes, of course! :/ Will fix right away.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-09-22 23:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-22 22:51 [PATCH net] net: orphan frags on stand-alone ptype in dev_queue_xmit_nit Willem de Bruijn
2017-09-22 23:04 ` Eric Dumazet
2017-09-22 23:15 ` Willem de Bruijn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox