]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: ipv6: nf_defrag: drop mangled skb on ream error
authorFlorian Westphal <fw@strlen.de>
Tue, 29 Nov 2016 01:17:34 +0000 (02:17 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 29 Nov 2016 19:23:58 +0000 (20:23 +0100)
commit62e2016623f4570d58d8d51e6d500491bd5ec1ad
treedfe0a3cb5dd51c4f7e33b704eacb2902d8279ee4
parentacd796d089ba8e9bc3f4d431ef628c7da9005533
netfilter: ipv6: nf_defrag: drop mangled skb on ream error

Dmitry Vyukov reported GPF in network stack that Andrey traced down to
negative nh offset in nf_ct_frag6_queue().

Problem is that all network headers before fragment header are pulled.
Normal ipv6 reassembly will drop the skb when errors occur further down
the line.

netfilter doesn't do this, and instead passed the original fragment
along.  That was also fine back when netfilter ipv6 defrag worked with
cloned fragments, as the original, pristine fragment was passed on.

So we either have to undo the pull op, or discard such fragments.
Since they're malformed after all (e.g. overlapping fragment) it seems
preferrable to just drop them.

Same for temporary errors -- it doesn't make sense to accept (and
perhaps forward!) only some fragments of same datagram.

Fixes: af86f1d5343927531 ("netfilter: ipv6: nf_defrag: avoid/free clone operations")
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Debugged-by: Andrey Konovalov <andreyknvl@google.com>
Diagnosed-by: Eric Dumazet <Eric Dumazet <edumazet@google.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/ipv6/netfilter/nf_conntrack_reasm.c
net/ipv6/netfilter/nf_defrag_ipv6_hooks.c