[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAOrHB_C77=Hgr1GFnM+kgDqiXOg9oFtROB-1UTA3YE93T1k4yg@mail.gmail.com>
Date: Tue, 29 Nov 2016 09:21:14 -0800
From: Pravin Shelar <pshelar@....org>
To: Daniele Di Proietto <diproiettod@....org>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
Florian Westphal <fw@...len.de>, Joe Stringer <joe@....org>
Subject: Re: [PATCH net] openvswitch: Fix skb leak in IPv6 reassembly.
On Tue, Nov 29, 2016 at 12:54 AM, Daniele Di Proietto
<diproiettod@....org> wrote:
>
>
> 2016-11-28 23:39 GMT-08:00 Pravin Shelar <pshelar@....org>:
>>
>> On Mon, Nov 28, 2016 at 3:43 PM, Daniele Di Proietto
>> <diproiettod@....org> 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 <fw@...len.de>
>> > CC: Pravin B Shelar <pshelar@....org>
>> > CC: Joe Stringer <joe@....org>
>> > Signed-off-by: Daniele Di Proietto <diproiettod@....org>
>> > ---
>> > 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 <pshelar@....org>
Powered by blists - more mailing lists