From: Joe Stringer <joe@ovn.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev <netdev@vger.kernel.org>,
fw@strlen.de, hannes@stressinduktion.org,
pravin shelar <pshelar@ovn.org>
Subject: Re: [PATCH net] inet: frag: Always orphan skbs inside ip_defrag()
Date: Tue, 26 Jan 2016 18:16:10 -0800 [thread overview]
Message-ID: <CAPWQB7EAD9CGSW3C-LMO1U1gHOOkeh3sTkS+gtpWVpkwChdBTw@mail.gmail.com> (raw)
In-Reply-To: <CAPWQB7GgKU8TC6RQNkkZppNrH64ufOH50g2VXHp8D8WC7_gh_g@mail.gmail.com>
On 25 January 2016 at 17:11, Joe Stringer <joe@ovn.org> wrote:
> On 22 January 2016 at 17:22, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> On Fri, 2016-01-22 at 15:49 -0800, Joe Stringer wrote:
>>> Later parts of the stack (including fragmentation) expect that there is
>>> never a socket attached to frag in a frag_list, however this invariant
>>> was not enforced on all defrag paths. This could lead to the
>>> BUG_ON(skb->sk) during ip_do_fragment(), as per the call stack at the
>>> end of this commit message.
>>>
>>> While the call could be added to openvswitch to fix this particular
>>> error, the head and tail of the frags list are already orphaned
>>> indirectly inside ip_defrag(), so it seems like the remaining fragments
>>> should all be orphaned in all circumstances.
>>
>>
>> Yes, it looks we have a problem, and even IP early demux apparently does
>> not check if incoming packet is a fragment.
>>
>> Your patch could also remove some socket leaks in this respect.
>>
>> I guess we also could add a safety check (ipv4 only, but ipv6 needs care
>> as well)
>>
>> diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
>> index b1209b63381f..99513c829213 100644
>> --- a/net/ipv4/ip_input.c
>> +++ b/net/ipv4/ip_input.c
>> @@ -316,7 +316,9 @@ static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
>> const struct iphdr *iph = ip_hdr(skb);
>> struct rtable *rt;
>>
>> - if (sysctl_ip_early_demux && !skb_dst(skb) && !skb->sk) {
>> + if (sysctl_ip_early_demux &&
>> + !skb_dst(skb) && !skb->sk &&
>> + !ip_is_fragment(iph)) {
>> const struct net_protocol *ipprot;
>> int protocol = iph->protocol;
>
> Thanks, I can roll this into a v2 (or keep as a separate patch?). I
> got sidetracked on the IPv6 side, some other issues are blocking me on
> that but I intend to continue following up there as well.
FWIW I confirmed that all frags in frag list coming back from
nf_ct_frag6_gather() have skb->sk == NULL, so this bug is not present
on that path.
next prev parent reply other threads:[~2016-01-27 2:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-22 23:49 [PATCH net] inet: frag: Always orphan skbs inside ip_defrag() Joe Stringer
2016-01-23 1:22 ` Eric Dumazet
2016-01-26 1:11 ` Joe Stringer
2016-01-26 5:58 ` Eric Dumazet
2016-01-27 0:59 ` [PATCH net] ipv4: early demux should be aware of fragments Eric Dumazet
2016-01-27 22:02 ` David Miller
2016-01-29 15:22 ` Eric Dumazet
2016-01-29 20:24 ` David Miller
2016-01-29 20:57 ` Eric Dumazet
2016-01-27 2:16 ` Joe Stringer [this message]
2016-01-29 0:02 ` [PATCH net] inet: frag: Always orphan skbs inside ip_defrag() David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPWQB7EAD9CGSW3C-LMO1U1gHOOkeh3sTkS+gtpWVpkwChdBTw@mail.gmail.com \
--to=joe@ovn.org \
--cc=eric.dumazet@gmail.com \
--cc=fw@strlen.de \
--cc=hannes@stressinduktion.org \
--cc=netdev@vger.kernel.org \
--cc=pshelar@ovn.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).