All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] tcp: call tcp_rate_skb_sent() when retransmit with unaligned skb->data
@ 2017-10-24 23:44 Yousuk Seung
  2017-10-26  8:51 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Yousuk Seung @ 2017-10-24 23:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Yousuk Seung, Neal Cardwell, Soheil Hassas Yeganeh

Current implementation calls tcp_rate_skb_sent() when tcp_transmit_skb()
is called when it clones skb only. Not calling tcp_rate_skb_sent() is OK
for all such code paths except from __tcp_retransmit_skb() which happens
when skb->data address is not aligned. This may rarely happen e.g. when
small amount of data is sent initially and the receiver partially acks
odd number of bytes for some reason, possibly malicious.

Signed-off-by: Yousuk Seung <ysseung@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv4/tcp_output.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 973befc36fd4..1151870018e3 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2843,8 +2843,10 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs)
 		nskb = __pskb_copy(skb, MAX_TCP_HEADER, GFP_ATOMIC);
 		err = nskb ? tcp_transmit_skb(sk, nskb, 0, GFP_ATOMIC) :
 			     -ENOBUFS;
-		if (!err)
+		if (!err) {
 			skb->skb_mstamp = tp->tcp_mstamp;
+			tcp_rate_skb_sent(sk, skb);
+		}
 	} else {
 		err = tcp_transmit_skb(sk, skb, 1, GFP_ATOMIC);
 	}
-- 
2.15.0.rc0.271.g36b669edcc-goog

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] tcp: call tcp_rate_skb_sent() when retransmit with unaligned skb->data
  2017-10-24 23:44 [PATCH net] tcp: call tcp_rate_skb_sent() when retransmit with unaligned skb->data Yousuk Seung
@ 2017-10-26  8:51 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-10-26  8:51 UTC (permalink / raw)
  To: ysseung; +Cc: netdev, ncardwell, soheil

From: Yousuk Seung <ysseung@google.com>
Date: Tue, 24 Oct 2017 16:44:42 -0700

> Current implementation calls tcp_rate_skb_sent() when tcp_transmit_skb()
> is called when it clones skb only. Not calling tcp_rate_skb_sent() is OK
> for all such code paths except from __tcp_retransmit_skb() which happens
> when skb->data address is not aligned. This may rarely happen e.g. when
> small amount of data is sent initially and the receiver partially acks
> odd number of bytes for some reason, possibly malicious.
> 
> Signed-off-by: Yousuk Seung <ysseung@google.com>
> Signed-off-by: Neal Cardwell <ncardwell@google.com>
> Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
> Acked-by: Eric Dumazet <edumazet@google.com>

This doesn't apply to any of m trees.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-26  8:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-24 23:44 [PATCH net] tcp: call tcp_rate_skb_sent() when retransmit with unaligned skb->data Yousuk Seung
2017-10-26  8:51 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.