Thread (3 messages) flat view 3 messages, 3 authors, 2018-12-21

Re: [PATCH] ipv6: frags: Fix bogus skb->sk in reassembled packets

From: Eric Dumazet <edumazet@google.com>
Date: 2018-12-20 13:27:05

On Thu, Dec 20, 2018 at 5:20 AM Herbert Xu [off-list ref] wrote:
quoted hunk ↗ jump to hunk
It was reported that IPsec would crash when it encounters an IPv6
reassembled packet because skb->sk is non-zero and not a valid
pointer.

This is because skb->sk is now a union with ip_defrag_offset.

This patch fixes this by resetting skb->sk when exiting from
the reassembly code.

Reported-by: Xiumei Mu <redacted>
Fixes: 219badfaade9 ("ipv6: frags: get rid of ip6frag_skb_cb/...")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 5c3c92713096..a98f95fb6eac 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -378,6 +378,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
                if (skb_try_coalesce(head, fp, &headstolen, &delta)) {
                        kfree_skb_partial(fp, headstolen);
                } else {
+                       fp->sk = NULL;
                        if (!skb_shinfo(head)->frag_list)
                                skb_shinfo(head)->frag_list = fp;
                        head->data_len += fp->len;

I wonder why this have not been done earlier in commit

commit 5d407b071dc369c26a38398326ee2be53651cfe4
Author: Taehee Yoo [off-list ref]
Date:   Mon Sep 10 02:47:05 2018 +0900

    ip: frags: fix crash in ip_do_fragment()

Maybe because the Fixes tag mentioned fa0f527358bd ("ip: use rb trees
for IP frag queue.")
and IPv6 reasm was not using rbtree ...

Oh well.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help