lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1422453433.29618.58.camel@edumazet-glaptop2.roam.corp.google.com>
Date:	Wed, 28 Jan 2015 05:57:13 -0800
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	David Miller <davem@...emloft.net>
Cc:	netdev <netdev@...r.kernel.org>
Subject: [PATCH net-next] ipv6: tcp: tcp_v6_send_response() should give an
 owner to skb

From: Eric Dumazet <edumazet@...gle.com>

RST packets and ACK packets sent on behalf of TIME_WAIT sockets
do not have a socket owner currently.

For sch_fq users, this means fq classifier has to fallback to packet
dissection and allocate one flow structure, while we generally send
a single packet. This is also an attack vector.

Note that ip6_xmit() correctly uses skb_set_owner_w() if skb needs
to be reallocated when head room is not big enough.

Simply use sock_wmalloc() instead of alloc_skb().

Note: This might increase false sharing on the ctl_sk, which is
shared by all cpus for a given network namespace. We might switch later
to a percpu socket as we do for IPv4.

Also use MAX_TCP_HEADER, as it makes the code shorter.

Signed-off-by: Eric Dumazet <edumazet@...gle.com>
---
 net/ipv6/tcp_ipv6.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 5d46832c6f72b89a278a3326918a3c8bff9afed4..cd4f7be3ecdd3628b07eb76bd2d4204753da23a6 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -809,12 +809,11 @@ static void tcp_v6_send_response(struct sock *sk, struct sk_buff *skb, u32 seq,
 		tot_len += TCPOLEN_MD5SIG_ALIGNED;
 #endif
 
-	buff = alloc_skb(MAX_HEADER + sizeof(struct ipv6hdr) + tot_len,
-			 GFP_ATOMIC);
-	if (buff == NULL)
+	buff = sock_wmalloc(ctl_sk, MAX_TCP_HEADER, 1, GFP_ATOMIC);
+	if (!buff)
 		return;
 
-	skb_reserve(buff, MAX_HEADER + sizeof(struct ipv6hdr) + tot_len);
+	skb_reserve(buff, MAX_TCP_HEADER);
 
 	t1 = (struct tcphdr *) skb_push(buff, tot_len);
 	skb_reset_transport_header(buff);


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ