From: Joao Martins Date: Mon, 10 Jun 2019 22:12:38 +0000 (+0100) Subject: tcp: fix fack_count accounting on tcp_shift_skb_data() X-Git-Tag: v4.1.12-124.31.3~81 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3909763a246b594af2e48c34027f7651ea9ba3a7;p=users%2Fjedix%2Flinux-maple.git tcp: fix fack_count accounting on tcp_shift_skb_data() v4.15 or since commit 737ff314563 ("tcp: use sequence distance to detect reordering") had switched from the packet-based FACK tracking to sequence-based. v4.14 and older still have the old logic and hence on tcp_skb_shift_data() needs to retain its original logic and have @fack_count in sync. In other words, we keep the increment of pcount with tcp_skb_pcount(skb) to later used that to update fack_count. To make it more explicit we track the new skb that gets incremented to pcount in @next_pcount, and we get to avoid the constant invocation of tcp_skb_pcount(skb) all together. Orabug: 29890820 Fixes: 1b56e4cb5dec ("tcp: limit payload size of sacked skbs") Reported-by: Alexey Kodanev Reviewed-by: John Haxby Reviewed-by: Rao Shoaib >>> Signed-off-by: Joao Martins Signed-off-by: Konrad Rzeszutek Wilk Signed-off-by: Brian Maly --- diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 4e0216760cc1..b042b3343b8c 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -1402,6 +1402,7 @@ static struct sk_buff *tcp_shift_skb_data(struct sock *sk, struct sk_buff *skb, struct tcp_sock *tp = tcp_sk(sk); struct sk_buff *prev; int mss; + int next_pcount; int pcount = 0; int len; int in_sack; @@ -1515,9 +1516,11 @@ static struct sk_buff *tcp_shift_skb_data(struct sock *sk, struct sk_buff *skb, goto out; len = skb->len; - pcount = tcp_skb_pcount(skb); - if (tcp_skb_shift(prev, skb, pcount, len)) - tcp_shifted_skb(sk, skb, state, pcount, len, mss, 0); + next_pcount = tcp_skb_pcount(skb); + if (tcp_skb_shift(prev, skb, next_pcount, len)) { + pcount += next_pcount; + tcp_shifted_skb(sk, skb, state, next_pcount, len, mss, 0); + } out: state->fack_count += pcount; return prev;