Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3073583imm; Sun, 1 Jul 2018 11:37:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdv8bvXki2eAbEKxv/4AR9+R62R5Zfj9Zry7od9AWmL/xFePh8DTMQWuqoEzVybZCBSLyb5 X-Received: by 2002:a65:61aa:: with SMTP id i10-v6mr2218296pgv.139.1530470276817; Sun, 01 Jul 2018 11:37:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530470276; cv=none; d=google.com; s=arc-20160816; b=k4KZ9l9BWlx3oI8u9qk/KtQ6G8E5WGx+rglQ2czRS7iS4OSSl8Ao+E0pXFm8NH8gqX REsI3ek+kxlOBzybhe69ypYvpRcMGBusoV0O8MZ0Jr7kVDtrhONMiRlFKEN1uRhjz2tW ixC21DenXj4tVzobyJzoLcqJVRbki5+uo1Ft1qvZTAHd9PuckumIPGbAE8kBwch+1Qyg muRsj8nq4zTkrRL8Vp7WGsl7DYOW6gFIwWplFR99pgsdcSOyPEO5dP1+p1htu7SRGN87 o5EBTYbLwXdsHCz+Gd9d0Jq+zMNdb2YAPmdD6MGXkkaxz0sDD0Q378yPdHn2aRGgwfuE o8zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=L11PILNM8Sg37ID3gs8gVhp9gbR82UjKMFRucQufWWw=; b=CiVvby7uCSEB3ONbFwEZegJgININKwxclI6hMmU7jKMYNmhkR+b1elExJENgjWTOLQ 6H4Q8BJnel7eSIgMfTH6vH+jXZDxhCTFI6RJrVJGDvJsTZnE2pJUvVpnsRffeZTJHIpN /s2VTN9eCNGcd4GcOJdN7XX4qOHCGBqeL2v4nLhAJb1i8kenjwjOFpffLmdZtd4H9o+3 DPpHnxpfNe/4zh3H/WIe5A5bt6717UQ0i0GpQBUNubOAl674bRqlL1Il3mi3PVeM+vrW GzNnUm8NFTp4S1Xzody5B8QpqwmwvZMUh0aQqiv4uDnbt7NTVqaYBusPHhq6a7kcUZUT RvSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g14-v6si14168354plo.95.2018.07.01.11.37.42; Sun, 01 Jul 2018 11:37:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753210AbeGAQPW (ORCPT + 99 others); Sun, 1 Jul 2018 12:15:22 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60544 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752467AbeGAQPT (ORCPT ); Sun, 1 Jul 2018 12:15:19 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id EEC42ACC; Sun, 1 Jul 2018 16:15:18 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frank van der Linden , Eric Dumazet , Balbir Singh , "David S. Miller" Subject: [PATCH 4.4 012/105] tcp: verify the checksum of the first data segment in a new connection Date: Sun, 1 Jul 2018 18:01:22 +0200 Message-Id: <20180701153150.356578061@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701153149.382300170@linuxfoundation.org> References: <20180701153149.382300170@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Frank van der Linden [ Upstream commit 4fd44a98ffe0d048246efef67ed640fdf2098a62 ] commit 079096f103fa ("tcp/dccp: install syn_recv requests into ehash table") introduced an optimization for the handling of child sockets created for a new TCP connection. But this optimization passes any data associated with the last ACK of the connection handshake up the stack without verifying its checksum, because it calls tcp_child_process(), which in turn calls tcp_rcv_state_process() directly. These lower-level processing functions do not do any checksum verification. Insert a tcp_checksum_complete call in the TCP_NEW_SYN_RECEIVE path to fix this. Fixes: 079096f103fa ("tcp/dccp: install syn_recv requests into ehash table") Signed-off-by: Frank van der Linden Signed-off-by: Eric Dumazet Tested-by: Balbir Singh Reviewed-by: Balbir Singh Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_ipv4.c | 4 ++++ net/ipv6/tcp_ipv6.c | 4 ++++ 2 files changed, 8 insertions(+) --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -1627,6 +1627,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; --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -1415,6 +1415,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;