aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2014-09-17 06:14:42 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-19 16:04:13 -0400
commitcb93471acc42b71fa3f2e46805020f2b323db64f (patch)
tree1d9839b9ee91606a5ac5e761d8fc6be41ef1208d /net/ipv4/tcp_input.c
parent3ff64259616225c27f3fae8ac05c77c36bfd0348 (diff)
tcp: do not fake tcp headers in tcp_send_rcvq()
Now we no longer rely on having tcp headers for skbs in receive queue, tcp repair do not need to build fake ones. Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index ea92f23ffaf1..02fb66d4a018 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4304,24 +4304,19 @@ static int __must_check tcp_queue_rcv(struct sock *sk, struct sk_buff *skb, int
4304 4304
4305int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size) 4305int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size)
4306{ 4306{
4307 struct sk_buff *skb = NULL; 4307 struct sk_buff *skb;
4308 struct tcphdr *th;
4309 bool fragstolen; 4308 bool fragstolen;
4310 4309
4311 if (size == 0) 4310 if (size == 0)
4312 return 0; 4311 return 0;
4313 4312
4314 skb = alloc_skb(size + sizeof(*th), sk->sk_allocation); 4313 skb = alloc_skb(size, sk->sk_allocation);
4315 if (!skb) 4314 if (!skb)
4316 goto err; 4315 goto err;
4317 4316
4318 if (tcp_try_rmem_schedule(sk, skb, size + sizeof(*th))) 4317 if (tcp_try_rmem_schedule(sk, skb, skb->truesize))
4319 goto err_free; 4318 goto err_free;
4320 4319
4321 th = (struct tcphdr *)skb_put(skb, sizeof(*th));
4322 skb_reset_transport_header(skb);
4323 memset(th, 0, sizeof(*th));
4324
4325 if (memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size)) 4320 if (memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size))
4326 goto err_free; 4321 goto err_free;
4327 4322
@@ -4329,7 +4324,7 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size)
4329 TCP_SKB_CB(skb)->end_seq = TCP_SKB_CB(skb)->seq + size; 4324 TCP_SKB_CB(skb)->end_seq = TCP_SKB_CB(skb)->seq + size;
4330 TCP_SKB_CB(skb)->ack_seq = tcp_sk(sk)->snd_una - 1; 4325 TCP_SKB_CB(skb)->ack_seq = tcp_sk(sk)->snd_una - 1;
4331 4326
4332 if (tcp_queue_rcv(sk, skb, sizeof(*th), &fragstolen)) { 4327 if (tcp_queue_rcv(sk, skb, 0, &fragstolen)) {
4333 WARN_ON_ONCE(fragstolen); /* should not happen */ 4328 WARN_ON_ONCE(fragstolen); /* should not happen */
4334 __kfree_skb(skb); 4329 __kfree_skb(skb);
4335 } 4330 }