aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
authorBoris Pismenny <borisp@mellanox.com>2018-07-13 07:33:38 -0400
committerDavid S. Miller <davem@davemloft.net>2018-07-16 03:12:09 -0400
commit41ed9c04aac2f8c6ee922e29ce5e69f185c5125b (patch)
tree8c2b86753dc8762924abd6a39c2d36476b0bd183 /net/ipv4/tcp_input.c
parent16e4edc297ffc9b643b8dd3da6b0d579753ea2b3 (diff)
tcp: Don't coalesce decrypted and encrypted SKBs
Prevent coalescing of decrypted and encrypted SKBs in GRO and TCP layer. Signed-off-by: Boris Pismenny <borisp@mellanox.com> Signed-off-by: Ilya Lesokhin <ilyal@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index fac5d03d4528..91dbb9afb950 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4343,6 +4343,11 @@ static bool tcp_try_coalesce(struct sock *sk,
4343 if (TCP_SKB_CB(from)->seq != TCP_SKB_CB(to)->end_seq) 4343 if (TCP_SKB_CB(from)->seq != TCP_SKB_CB(to)->end_seq)
4344 return false; 4344 return false;
4345 4345
4346#ifdef CONFIG_TLS_DEVICE
4347 if (from->decrypted != to->decrypted)
4348 return false;
4349#endif
4350
4346 if (!skb_try_coalesce(to, from, fragstolen, &delta)) 4351 if (!skb_try_coalesce(to, from, fragstolen, &delta))
4347 return false; 4352 return false;
4348 4353
@@ -4871,6 +4876,9 @@ restart:
4871 break; 4876 break;
4872 4877
4873 memcpy(nskb->cb, skb->cb, sizeof(skb->cb)); 4878 memcpy(nskb->cb, skb->cb, sizeof(skb->cb));
4879#ifdef CONFIG_TLS_DEVICE
4880 nskb->decrypted = skb->decrypted;
4881#endif
4874 TCP_SKB_CB(nskb)->seq = TCP_SKB_CB(nskb)->end_seq = start; 4882 TCP_SKB_CB(nskb)->seq = TCP_SKB_CB(nskb)->end_seq = start;
4875 if (list) 4883 if (list)
4876 __skb_queue_before(list, skb, nskb); 4884 __skb_queue_before(list, skb, nskb);
@@ -4898,6 +4906,10 @@ restart:
4898 skb == tail || 4906 skb == tail ||
4899 (TCP_SKB_CB(skb)->tcp_flags & (TCPHDR_SYN | TCPHDR_FIN))) 4907 (TCP_SKB_CB(skb)->tcp_flags & (TCPHDR_SYN | TCPHDR_FIN)))
4900 goto end; 4908 goto end;
4909#ifdef CONFIG_TLS_DEVICE
4910 if (skb->decrypted != nskb->decrypted)
4911 goto end;
4912#endif
4901 } 4913 }
4902 } 4914 }
4903 } 4915 }