aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-09-03 13:29:12 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-09-14 09:54:56 -0400
commita22eb149b18ed385c72d527c42dc398c97b6387f (patch)
tree953398dc996db0d35d9191df893a60eae54ac614
parentef1f8bcdc2febd53978905b5b0a5201104cce653 (diff)
net: ipv6: tcp: fix potential use after free in tcp_v6_do_rcv
[ Upstream commit 3a1c756590633c0e86df606e5c618c190926a0df ] In tcp_v6_do_rcv() code, when processing pkt options, we soley work on our skb clone opt_skb that we've created earlier before entering tcp_rcv_established() on our way. However, only in condition ... if (np->rxopt.bits.rxtclass) np->rcv_tclass = ipv6_get_dsfield(ipv6_hdr(skb)); ... we work on skb itself. As we extract every other information out of opt_skb in ipv6_pktoptions path, this seems wrong, since skb can already be released by tcp_rcv_established() earlier on. When we try to access it in ipv6_hdr(), we will dereference freed skb. [ Bug added by commit 4c507d2897bd9b ("net: implement IP_RECVTOS for IP_PKTOPTIONS") ] Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Cc: Eric Dumazet <eric.dumazet@gmail.com> Acked-by: Eric Dumazet <edumazet@google.com> Acked-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/ipv6/tcp_ipv6.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 0a17ed9eaf39..66c718854e5a 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1426,7 +1426,7 @@ ipv6_pktoptions:
1426 if (np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) 1426 if (np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim)
1427 np->mcast_hops = ipv6_hdr(opt_skb)->hop_limit; 1427 np->mcast_hops = ipv6_hdr(opt_skb)->hop_limit;
1428 if (np->rxopt.bits.rxtclass) 1428 if (np->rxopt.bits.rxtclass)
1429 np->rcv_tclass = ipv6_get_dsfield(ipv6_hdr(skb)); 1429 np->rcv_tclass = ipv6_get_dsfield(ipv6_hdr(opt_skb));
1430 if (ipv6_opt_accepted(sk, opt_skb)) { 1430 if (ipv6_opt_accepted(sk, opt_skb)) {
1431 skb_set_owner_r(opt_skb, sk); 1431 skb_set_owner_r(opt_skb, sk);
1432 opt_skb = xchg(&np->pktoptions, opt_skb); 1432 opt_skb = xchg(&np->pktoptions, opt_skb);