Skip to content

Commit 3b11775

Browse files
edumazetdavem330
authored andcommitted
tcp: do not mangle skb->cb[] in tcp_make_synack()
Christoph Paasch sent a patch to address the following issue : tcp_make_synack() is leaving some TCP private info in skb->cb[], then send the packet by other means than tcp_transmit_skb() tcp_transmit_skb() makes sure to clear skb->cb[] to not confuse IPv4/IPV6 stacks, but we have no such cleanup for SYNACK. tcp_make_synack() should not use tcp_init_nondata_skb() : tcp_init_nondata_skb() really should be limited to skbs put in write/rtx queues (the ones that are only sent via tcp_transmit_skb()) This patch fixes the issue and should even save few cpu cycles ;) Fixes: 971f10e ("tcp: better TCP_SKB_CB layout to reduce cache line misses") Signed-off-by: Eric Dumazet <[email protected]> Reported-by: Christoph Paasch <[email protected]> Reviewed-by: Christoph Paasch <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 25dd169 commit 3b11775

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

net/ipv4/tcp_output.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3180,13 +3180,8 @@ struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst,
31803180
th->source = htons(ireq->ir_num);
31813181
th->dest = ireq->ir_rmt_port;
31823182
skb->mark = ireq->ir_mark;
3183-
/* Setting of flags are superfluous here for callers (and ECE is
3184-
* not even correctly set)
3185-
*/
3186-
tcp_init_nondata_skb(skb, tcp_rsk(req)->snt_isn,
3187-
TCPHDR_SYN | TCPHDR_ACK);
3188-
3189-
th->seq = htonl(TCP_SKB_CB(skb)->seq);
3183+
skb->ip_summed = CHECKSUM_PARTIAL;
3184+
th->seq = htonl(tcp_rsk(req)->snt_isn);
31903185
/* XXX data is queued and acked as is. No buffer/window check */
31913186
th->ack_seq = htonl(tcp_rsk(req)->rcv_nxt);
31923187

0 commit comments

Comments
 (0)