Commit e776435a authored by Joao Martins's avatar Joao Martins Committed by Stefan Bader

UBUNTU: SAUCE: tcp: fix fack_count accounting on tcp_shift_skb_data()

v4.15 or since commit 737ff314 ("tcp: use sequence distance to
detect reordering") had switched from the packet-based FACK tracking and
switched 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.
Reported-by: default avatarAlexey Kodanev <alexey.kodanev@oracle.com>
Signed-off-by: default avatarJoao Martins <joao.m.martins@oracle.com>

BugLink: https://bugs.launchpad.net/bugs/1831637 (Remote denial of service (system crash) caused by integer overflow in TCP SACK handling (LP: #1831637))
Signed-off-by: default avatarTyler Hicks <tyhicks@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent 9094a474
......@@ -1363,6 +1363,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;
......@@ -1476,9 +1477,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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment