Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7982d5e1 authored by Philip Love's avatar Philip Love Committed by David S. Miller
Browse files

tcp: fix tcp header size miscalculation when window scale is unused



The size of the TCP header is miscalculated when the window scale ends
up being 0. Additionally, this can be induced by sending a SYN to a
passive open port with a window scale option with value 0.

Signed-off-by: default avatarPhilip Love <love_phil@emc.com>
Signed-off-by: default avatarAdam Langley <agl@imperialviolet.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fe439dd0
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -468,6 +468,7 @@ static unsigned tcp_syn_options(struct sock *sk, struct sk_buff *skb,
	}
	if (likely(sysctl_tcp_window_scaling)) {
		opts->ws = tp->rx_opt.rcv_wscale;
		if(likely(opts->ws))
			size += TCPOLEN_WSCALE_ALIGNED;
	}
	if (likely(sysctl_tcp_sack)) {
@@ -509,6 +510,7 @@ static unsigned tcp_synack_options(struct sock *sk,

	if (likely(ireq->wscale_ok)) {
		opts->ws = ireq->rcv_wscale;
		if(likely(opts->ws))
			size += TCPOLEN_WSCALE_ALIGNED;
	}
	if (likely(doing_ts)) {