[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANP3RGfCDumc40Tr2gr0KHenQ6x29tWAjhnM+8yk7nK5nNHRFA@mail.gmail.com>
Date: Tue, 23 Oct 2018 14:04:18 -0700
From: Maciej Żenczykowski <maze@...gle.com>
To: Florian Westphal <fw@...len.de>
Cc: netfilter-devel@...r.kernel.org,
Lorenzo Colitti <lorenzo@...gle.com>,
Eric Dumazet <edumazet@...gle.com>,
Linux NetDev <netdev@...r.kernel.org>
Subject: Re: [PATCH nf] netfilter: ipv6: fix oops when defragmenting locally
generated fragments
On Tue, Oct 23, 2018 at 7:47 AM, Florian Westphal <fw@...len.de> wrote:
> Unlike ipv4 and normal ipv6 defrag, netfilter ipv6 defragmentation did
> not save/restore skb->dst.
>
> This causes oops when handling locally generated ipv6 fragments, as
> output path needs a valid dst.
>
> Reported-by: Maciej Żenczykowski <zenczykowski@...il.com>
> Fixes: 84379c9afe01 ("netfilter: ipv6: nf_defrag: drop skb dst before queueing")
> Signed-off-by: Florian Westphal <fw@...len.de>
> ---
> net/ipv6/netfilter/nf_conntrack_reasm.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
> index 8f68a518d9db..f76bd4d15704 100644
> --- a/net/ipv6/netfilter/nf_conntrack_reasm.c
> +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
> @@ -587,11 +587,16 @@ int nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user)
> */
> ret = -EINPROGRESS;
> if (fq->q.flags == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) &&
> - fq->q.meat == fq->q.len &&
> - nf_ct_frag6_reasm(fq, skb, dev))
> - ret = 0;
> - else
> + fq->q.meat == fq->q.len) {
> + unsigned long orefdst = skb->_skb_refdst;
> +
> + skb->_skb_refdst = 0UL;
> + if (nf_ct_frag6_reasm(fq, skb, dev))
> + ret = 0;
> + skb->_skb_refdst = orefdst;
> + } else {
> skb_dst_drop(skb);
> + }
>
> out_unlock:
> spin_unlock_bh(&fq->q.lock);
> --
> 2.18.1
>
I don't quite follow how this fixes things, but I'll trust you on it.
(nor do I understand why only 4.9 LTS appears to crash with a null ptr deref)
Thanks for the fix.
Powered by blists - more mailing lists