From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pravin Shelar Subject: Re: [PATCH net] openvswitch: Fix skb leak in IPv6 reassembly. Date: Tue, 29 Nov 2016 09:21:14 -0800 Message-ID: References: <20161128234353.4262-1-diproiettod@ovn.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: Linux Kernel Network Developers , Florian Westphal , Joe Stringer To: Daniele Di Proietto Return-path: Received: from relay2-d.mail.gandi.net ([217.70.183.194]:51850 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934141AbcK2RVU (ORCPT ); Tue, 29 Nov 2016 12:21:20 -0500 Received: from mfilter48-d.gandi.net (mfilter48-d.gandi.net [217.70.178.179]) by relay2-d.mail.gandi.net (Postfix) with ESMTP id 17F00C5A56 for ; Tue, 29 Nov 2016 18:21:18 +0100 (CET) Received: from relay2-d.mail.gandi.net ([IPv6:::ffff:217.70.183.194]) by mfilter48-d.gandi.net (mfilter48-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id 3MV4CS8DkZu1 for ; Tue, 29 Nov 2016 18:21:16 +0100 (CET) Received: from mail-io0-f171.google.com (mail-io0-f171.google.com [209.85.223.171]) (Authenticated sender: pshelar@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 900C7C5A43 for ; Tue, 29 Nov 2016 18:21:16 +0100 (CET) Received: by mail-io0-f171.google.com with SMTP id m5so163287505ioe.3 for ; Tue, 29 Nov 2016 09:21:16 -0800 (PST) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Tue, Nov 29, 2016 at 12:54 AM, Daniele Di Proietto wrote: > > > 2016-11-28 23:39 GMT-08:00 Pravin Shelar : >> >> On Mon, Nov 28, 2016 at 3:43 PM, Daniele Di Proietto >> wrote: >> > If nf_ct_frag6_gather() returns an error other than -EINPROGRESS, it >> > means that we still have a reference to the skb. We should free it >> > before returning from handle_fragments, as stated in the comment above. >> > >> > Fixes: daaa7d647f81 ("netfilter: ipv6: avoid nf_iterate recursion") >> > CC: Florian Westphal >> > CC: Pravin B Shelar >> > CC: Joe Stringer >> > Signed-off-by: Daniele Di Proietto >> > --- >> > net/openvswitch/conntrack.c | 5 ++++- >> > 1 file changed, 4 insertions(+), 1 deletion(-) >> > >> > diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c >> > index 31045ef..fecefa2 100644 >> > --- a/net/openvswitch/conntrack.c >> > +++ b/net/openvswitch/conntrack.c >> > @@ -370,8 +370,11 @@ static int handle_fragments(struct net *net, struct >> > sw_flow_key *key, >> > skb_orphan(skb); >> > memset(IP6CB(skb), 0, sizeof(struct inet6_skb_parm)); >> > err = nf_ct_frag6_gather(net, skb, user); >> > - if (err) >> > + if (err) { >> > + if (err != -EINPROGRESS) >> > + kfree_skb(skb); >> > return err; >> > + } >> > >> >> This fixes the code. But the patch is adding yet another skb-kfree in >> conntrack code. we could simplify it by reusing error handling in >> do_execute_actions(). >> If you think that is too complicated for stable branch, I am fine with >> this patch going in as it is. > > > I thought it was simpler to handle this here rather than changing the > interface of > handle_fragments() and ovs_ct_execute(). Also this is more similar to the v4 > case, > where ip_defrag() frees the skb in case of error. > > What do you think? I agree this is simple enough for stable branch. I will check if ct action error handling could be simplified bit. Acked-by: Pravin B Shelar