]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - net/ipv4/tcp_ipv4.c
tcp: verify the checksum of the first data segment in a new connection
[mirror_ubuntu-bionic-kernel.git] / net / ipv4 / tcp_ipv4.c
index 94e28350f4205b1a57809d5471d7e2ade51f5196..8b36dc6f7a85745694d596df2055343d9804dc50 100644 (file)
@@ -705,7 +705,8 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb)
         */
        if (sk) {
                arg.bound_dev_if = sk->sk_bound_dev_if;
-               trace_tcp_send_reset(sk, skb);
+               if (sk_fullsock(sk))
+                       trace_tcp_send_reset(sk, skb);
        }
 
        BUILD_BUG_ON(offsetof(struct sock, sk_bound_dev_if) !=
@@ -1679,6 +1680,10 @@ process:
                        reqsk_put(req);
                        goto discard_it;
                }
+               if (tcp_checksum_complete(skb)) {
+                       reqsk_put(req);
+                       goto csum_error;
+               }
                if (unlikely(sk->sk_state != TCP_LISTEN)) {
                        inet_csk_reqsk_queue_drop_and_put(sk, req);
                        goto lookup;