From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zoltan Kiss Subject: Re: [PATCH] core, nfqueue, openvswitch: Orphan frags in skb_zerocopy and handle errors Date: Wed, 19 Mar 2014 21:07:08 +0000 Message-ID: <532A06FC.5000001@citrix.com> References: <1395261516-305-1-git-send-email-zoltan.kiss@citrix.com> <532A026E.5070609@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Cc: netfilter-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Miklos Szeredi , kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, "Michael S. Tsirkin" , Jason Wang , Eric Dumazet , Jan Beulich , Tom Herbert , Herbert Xu , coreteam-Cap9r6Oaw4JrovVCs/uTlw@public.gmane.org, Jozsef Kadlecsik , xen-devel-GuqFBffKawtpuQazS67q72D2FQJk+8+b@public.gmane.org, Pablo Neira Ayuso , Jiri Pirko , Paul Durrant , netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Florian Westphal , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, "David S. Miller" , Daniel Borkmann , netfilter-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Joe Perches , Patrick McHardy To: Thomas Graf , Jesse Gross , , Return-path: In-Reply-To: <532A026E.5070609-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-yBygre7rU0TnMu66kgdUjQ@public.gmane.org Sender: "dev" List-Id: netfilter-devel.vger.kernel.org On 19/03/14 20:47, Thomas Graf wrote: > On 03/19/2014 09:38 PM, Zoltan Kiss wrote: >> skb_zerocopy can copy elements of the frags array between skbs, but it >> doesn't >> orphan them. Also, it doesn't handle errors, so this patch takes care >> of that >> as well. >> >> Signed-off-by: Zoltan Kiss >> --- > >> + if (unlikely(skb_orphan_frags(to, GFP_ATOMIC))) { >> + skb_tx_error(to); >> + return -ENOMEM; >> } > > I think you should move this down to right before we iterate over the > frags. I agree, I was mislead by that __skb_fill_page_desc, but now I see it is actually the head buffer of the source, not a frag from there. And in case of a failure in skb_copy_bits we can spare an orphan_frag. Zoli