Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1582788
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 4.4 09/20] ipv6: tcp: add a missing tcp_v6_restore_cb() |
| Date | 2017-02-16 19:10 +0100 |
| Message-ID | <tbyFc-1Cv-45@gated-at.bofh.it> (permalink) |
| References | <tbyvw-1iO-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@google.com>
[ Upstream commit ebf6c9cb23d7e56eec8575a88071dec97ad5c6e2 ]
Dmitry reported use-after-free in ip6_datagram_recv_specific_ctl()
A similar bug was fixed in commit 8ce48623f0cf ("ipv6: tcp: restore
IP6CB for pktoptions skbs"), but I missed another spot.
tcp_v6_syn_recv_sock() can indeed set np->pktoptions from ireq->pktopts
Fixes: 971f10eca186 ("tcp: better TCP_SKB_CB layout to reduce cache line misses")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv6/tcp_ipv6.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -974,6 +974,16 @@ drop:
return 0; /* don't send reset */
}
+static void tcp_v6_restore_cb(struct sk_buff *skb)
+{
+ /* We need to move header back to the beginning if xfrm6_policy_check()
+ * and tcp_v6_fill_cb() are going to be called again.
+ * ip6_datagram_recv_specific_ctl() also expects IP6CB to be there.
+ */
+ memmove(IP6CB(skb), &TCP_SKB_CB(skb)->header.h6,
+ sizeof(struct inet6_skb_parm));
+}
+
static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,
struct request_sock *req,
struct dst_entry *dst,
@@ -1163,8 +1173,10 @@ static struct sock *tcp_v6_syn_recv_sock
sk_gfp_atomic(sk, GFP_ATOMIC));
consume_skb(ireq->pktopts);
ireq->pktopts = NULL;
- if (newnp->pktoptions)
+ if (newnp->pktoptions) {
+ tcp_v6_restore_cb(newnp->pktoptions);
skb_set_owner_r(newnp->pktoptions, newsk);
+ }
}
}
@@ -1179,16 +1191,6 @@ out:
return NULL;
}
-static void tcp_v6_restore_cb(struct sk_buff *skb)
-{
- /* We need to move header back to the beginning if xfrm6_policy_check()
- * and tcp_v6_fill_cb() are going to be called again.
- * ip6_datagram_recv_specific_ctl() also expects IP6CB to be there.
- */
- memmove(IP6CB(skb), &TCP_SKB_CB(skb)->header.h6,
- sizeof(struct inet6_skb_parm));
-}
-
/* The socket must have it's spinlock held when we get
* here, unless it is a TCP_LISTEN socket.
*
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 4.4 00/20] 4.4.50-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-16 19:00 +0100
[PATCH 4.4 07/20] netlabel: out of bound access in cipso_v4_validate() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-16 19:10 +0100
[PATCH 4.4 13/20] mlx4: Invoke softirqs after napi_reschedule Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-16 19:10 +0100
[PATCH 4.4 14/20] sctp: avoid BUG_ON on sctp_wait_for_sndbuf Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-16 19:10 +0100
Re: [PATCH 4.4 14/20] sctp: avoid BUG_ON on sctp_wait_for_sndbuf Ben Hutchings <ben@decadent.org.uk> - 2017-02-21 17:10 +0100
Re: [PATCH 4.4 14/20] sctp: avoid BUG_ON on sctp_wait_for_sndbuf Marcelo <marcelo.leitner@gmail.com> - 2017-02-21 18:00 +0100
Re: [PATCH 4.4 14/20] sctp: avoid BUG_ON on sctp_wait_for_sndbuf Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> - 2017-02-21 21:00 +0100
[PATCH 4.4 03/20] ipv6: pointer math error in ip6_tnl_parse_tlv_enc_lim() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-16 19:10 +0100
[PATCH 4.4 02/20] ipv6: fix ip6_tnl_parse_tlv_enc_lim() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-16 19:10 +0100
[PATCH 4.4 09/20] ipv6: tcp: add a missing tcp_v6_restore_cb() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-16 19:10 +0100
[PATCH 4.4 01/20] can: Fix kernel panic at security_sock_rcv_skb Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-16 19:10 +0100
[PATCH 4.4 04/20] tcp: fix 0 divide in __tcp_select_window() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-16 19:10 +0100
[PATCH 4.4 19/20] l2tp: do not use udp_ioctl() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-16 19:10 +0100
[PATCH 4.4 08/20] ip6_gre: fix ip6gre_err() invalid reads Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-16 19:10 +0100
[PATCH 4.4 20/20] tcp: fix mark propagation with fwmark_reflect enabled Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-16 19:10 +0100
[PATCH 4.4 17/20] packet: round up linear to header len Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-16 19:10 +0100
[PATCH 4.4 11/20] tun: read vnet_hdr_sz once Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-16 19:20 +0100
Re: [PATCH 4.4 00/20] 4.4.50-stable review Guenter Roeck <linux@roeck-us.net> - 2017-02-17 11:40 +0100
Re: [PATCH 4.4 00/20] 4.4.50-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-18 00:50 +0100
csiph-web