Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1135849ybt; Tue, 7 Jul 2020 08:32:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5yf9LW3Iv8t5aeyO87EzgLGEtX8cwfGseonllYzzb2gdvr+NaSKq5VnDB6VfoiTcBQ4Fm X-Received: by 2002:aa7:d353:: with SMTP id m19mr60071667edr.75.1594135950666; Tue, 07 Jul 2020 08:32:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594135950; cv=none; d=google.com; s=arc-20160816; b=oG9Hc0zHkwwxuL13+E82MS6h/rAH6R7/6fZG7GKiCMJpbr0QaG9N1vttJtqNdKocIi MZHBQQL/FMkhryyfUnAihPQT58HB43cwVe1qiadNe+cb47gYTdig3MZEvC9RtW04CE+w 6IwxWCVnQk9G68yTw2PGiL+t+i7JfKdR1XCkVrcncurEFVQpo4X7plTihOKDfkIIv/z3 VqHCv33qigDbbppOXgBGrnMTYJFNsbvMPUP+ArdC0k7k3iTkyvjOXZt2qOndhLLuUpef czKkVZArWTWryMZDKWUdpD9pHaQxsk43WPG/Bd6KLbJGbbvb3Xoy/syNIjM7Sp+nX5Xe TiCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=P2cTFeE/3a4i0Ti5gVCBn84ziKtgmS4uyH6MvEfRS5Q=; b=hO+eW3RunXgh/Cdu268ZrXCPByauI88S7UOmEbVw2aKd2AoaE1/s4i8cizvgktRP+1 8NJpZ2kQ2rRcoySRI/7UmCiMpjTTRozEMSLHC8xnuRbKgn6CDp3b+VLWWQ+ELWQNyIpo 56bZEsGZr73nM5UXiu1C1FiOwdr9luQhw1t2KzM0/jwqgLw3RyNlHhYUVMw4Q/t55lCI QXHktGGwrMO6pRBzoT2UG5n2Dfi3cNNnvCeEoAc8jcrWEgsvLkrg1L0FkaBnxOUbHf/p NfvN9Mm1cd/xGwCHkaqJezDY9pglJHUU5j+oxGnAsZyKWATcGhh8nvd6xu28oWhGXr+o OlAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="H+x8z/7g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m16si14175241eji.77.2020.07.07.08.32.06; Tue, 07 Jul 2020 08:32:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="H+x8z/7g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729632AbgGGPY0 (ORCPT + 99 others); Tue, 7 Jul 2020 11:24:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:37952 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730085AbgGGPYW (ORCPT ); Tue, 7 Jul 2020 11:24:22 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AC89B206F6; Tue, 7 Jul 2020 15:24:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594135462; bh=co+nTpKG8qYDYuVZfFmnb13CQYw05JwSHsxV7dRzXTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H+x8z/7gpJjx3WJobqgEmN4qkJCNooz1gtqxZuyj49vJsGwQ3i1iP1Kt7/LbMlYFi LEihZfQbBoByZ/OWOeTVVuEAmfd2PE2uxaCZz1PuAz+DfDZrfA3DgpQ0Y/c8ST9mb7 /0u7hbgQ7b2F85B9oiixADsJ0v/c31Ja84F5420o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Abeni , Mat Martineau , "David S. Miller" , Sasha Levin Subject: [PATCH 5.7 050/112] mptcp: drop MP_JOIN request sock on syn cookies Date: Tue, 7 Jul 2020 17:16:55 +0200 Message-Id: <20200707145803.384930723@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200707145800.925304888@linuxfoundation.org> References: <20200707145800.925304888@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paolo Abeni [ Upstream commit 9e365ff576b7c1623bbc5ef31ec652c533e2f65e ] Currently any MPTCP socket using syn cookies will fallback to TCP at 3rd ack time. In case of MP_JOIN requests, the RFC mandate closing the child and sockets, but the existing error paths do not handle the syncookie scenario correctly. Address the issue always forcing the child shutdown in case of MP_JOIN fallback. Fixes: ae2dd7164943 ("mptcp: handle tcp fallback when using syn cookies") Signed-off-by: Paolo Abeni Reviewed-by: Mat Martineau Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/mptcp/subflow.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index db3e4e74e7857..0112ead58fd8b 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -424,22 +424,25 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk); struct mptcp_subflow_request_sock *subflow_req; struct mptcp_options_received mp_opt; - bool fallback_is_fatal = false; + bool fallback, fallback_is_fatal; struct sock *new_msk = NULL; - bool fallback = false; struct sock *child; pr_debug("listener=%p, req=%p, conn=%p", listener, req, listener->conn); - /* we need later a valid 'mp_capable' value even when options are not - * parsed + /* After child creation we must look for 'mp_capable' even when options + * are not parsed */ mp_opt.mp_capable = 0; - if (tcp_rsk(req)->is_mptcp == 0) + + /* hopefully temporary handling for MP_JOIN+syncookie */ + subflow_req = mptcp_subflow_rsk(req); + fallback_is_fatal = subflow_req->mp_join; + fallback = !tcp_rsk(req)->is_mptcp; + if (fallback) goto create_child; /* if the sk is MP_CAPABLE, we try to fetch the client key */ - subflow_req = mptcp_subflow_rsk(req); if (subflow_req->mp_capable) { if (TCP_SKB_CB(skb)->seq != subflow_req->ssn_offset + 1) { /* here we can receive and accept an in-window, @@ -460,12 +463,11 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, if (!new_msk) fallback = true; } else if (subflow_req->mp_join) { - fallback_is_fatal = true; mptcp_get_options(skb, &mp_opt); if (!mp_opt.mp_join || !subflow_hmac_valid(req, &mp_opt)) { SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC); - return NULL; + fallback = true; } } -- 2.25.1