From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Graf Subject: Re: [PATCH v3] core, nfqueue, openvswitch: Orphan frags in skb_zerocopy and handle errors Date: Thu, 20 Mar 2014 23:22:53 +0100 Message-ID: <532B6A3D.1060600@redhat.com> References: <1395331354-23659-1-git-send-email-zoltan.kiss@citrix.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1395331354-23659-1-git-send-email-zoltan.kiss-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-yBygre7rU0TnMu66kgdUjQ@public.gmane.org Sender: "dev" Content-Type: text/plain; charset="us-ascii"; format="flowed" To: Zoltan Kiss , Jesse Gross , pshelar-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org, dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org 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 , 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, Daniel Borkmann , netfilter-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Joe Perches , "David S. Miller" On 03/20/2014 05:02 PM, Zoltan Kiss wrote: > --- a/net/openvswitch/datapath.c > +++ b/net/openvswitch/datapath.c > @@ -464,7 +464,9 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, > } > nla->nla_len = nla_attr_size(skb->len); > > - skb_zerocopy(user_skb, skb, skb->len, hlen); > + err = skb_zerocopy(user_skb, skb, skb->len, hlen); > + if (err) > + goto out; > > /* Pad OVS_PACKET_ATTR_PACKET if linear copy was performed */ > if (!(dp->user_features & OVS_DP_F_UNALIGNED)) { > @@ -478,6 +480,7 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, > > err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid); > out: > + skb_tx_error(skb); Really sorry to bug you again. We'll get this right ;-) Patch looks great except for this call to skb_tx_error() which is now done in the error *and* success path. Make the call conditional on if (err) and we're good. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759781AbaCTWXq (ORCPT ); Thu, 20 Mar 2014 18:23:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26248 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758342AbaCTWXn (ORCPT ); Thu, 20 Mar 2014 18:23:43 -0400 Message-ID: <532B6A3D.1060600@redhat.com> Date: Thu, 20 Mar 2014 23:22:53 +0100 From: Thomas Graf Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Zoltan Kiss , Jesse Gross , pshelar@nicira.com, dev@openvswitch.org CC: "David S. Miller" , Pablo Neira Ayuso , Jozsef Kadlecsik , Eric Dumazet , Daniel Borkmann , Tom Herbert , Jason Wang , Florian Westphal , Joe Perches , Simon Horman , Jiri Pirko , "Michael S. Tsirkin" , Paul Durrant , Jan Beulich , Herbert Xu , Miklos Szeredi , netfilter-devel@vger.kernel.org, netfilter@vger.kernel.org, xen-devel@lists.xenproject.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH v3] core, nfqueue, openvswitch: Orphan frags in skb_zerocopy and handle errors References: <1395331354-23659-1-git-send-email-zoltan.kiss@citrix.com> In-Reply-To: <1395331354-23659-1-git-send-email-zoltan.kiss@citrix.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/20/2014 05:02 PM, Zoltan Kiss wrote: > --- a/net/openvswitch/datapath.c > +++ b/net/openvswitch/datapath.c > @@ -464,7 +464,9 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, > } > nla->nla_len = nla_attr_size(skb->len); > > - skb_zerocopy(user_skb, skb, skb->len, hlen); > + err = skb_zerocopy(user_skb, skb, skb->len, hlen); > + if (err) > + goto out; > > /* Pad OVS_PACKET_ATTR_PACKET if linear copy was performed */ > if (!(dp->user_features & OVS_DP_F_UNALIGNED)) { > @@ -478,6 +480,7 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, > > err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid); > out: > + skb_tx_error(skb); Really sorry to bug you again. We'll get this right ;-) Patch looks great except for this call to skb_tx_error() which is now done in the error *and* success path. Make the call conditional on if (err) and we're good.