From nobody Tue May 7 01:06:38 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6a06:869:b0:4b8:7781:bd2f with SMTP id d41csp4281343pis; Wed, 11 May 2022 06:23:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyChPQ2T8Du0MbamQQ4DxuhqqWPAjqO0GkonxR3O0Aw/9Orpk0fhBmDVfX4yk6uQoIMuDjZ X-Received: by 2002:a05:6871:4592:b0:ed:feb5:c24a with SMTP id nl18-20020a056871459200b000edfeb5c24amr2765167oab.135.1652275428711; Wed, 11 May 2022 06:23:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652275428; cv=none; d=google.com; s=arc-20160816; b=GklShB2CX3Lo/OhNuG+2iNP53OPKUmN9Torbkzfel7Ni1GxaX5JYcpM0P1n/PdIPD7 nlfbrd9KJTXSY5ZEZxKj4FmVJRjlAlotZGcr/Gygb5xPv07LrcXzmBy3oUavdKHqZFEy b0hD63Ve3aTE5EsDq0aDLVg8YpSk78YKGVugASLxSdCI9ZNJ9FySUGjeRNX+vQtHT47D xqIKF8HdKKFrp2RKwPjJYA5+mvPXMY55mNzBnbyMGbmQZ+DXAv3Oxp30rHp8E8njlCqM g1ehBtLClJu5Sb8h0xuMBUyD8Ql88P7C+PWQ1yd+oTEGOXD3vJ+cec6PtTAOf2v34heq PLPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:to:from :dkim-signature; bh=6S2w0/50GdrBpJkkutTW0xko0umxmLnFBJfJW9sJDGQ=; b=npFEijzTKDc1iMzwQiLOmOSctt16lqCEQ5lVO/rV/sjBx8IsiYSuyJqbZXtLdJCpg5 KJUbEC2TuqqPMP0Iwuk4GkafLe4bB6YsjXO8ueg3ui265LlWT+ZhGolmchN5+pPjPatX o3RB6sEbO+17zs7QV8COpf2WTo5O4QTB5e308YFVdoy8BvNYiqnkYpC6zdNsSG1Qyyob EjifdQOxlWTLmawG/VMzM9bWieWX3rKSNw3mb0m9En2Q5hWcfb+bcYuNTFRolwT94c9O UOrh5zmuYdX58y2INRx1YPD6ZWBYdAK4lHq/gSKQgBdPUXOHmJ+Eg1KLJXCev+n3ULLO GUxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HhZX3O5n; spf=pass (google.com: domain of mptcp+bounces-5255-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:4040:4f00::1 as permitted sender) smtp.mailfrom="mptcp+bounces-5255-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from da.mirrors.kernel.org (da.mirrors.kernel.org. [2604:1380:4040:4f00::1]) by mx.google.com with ESMTPS id x20-20020a056808145400b0032670ef9638si2375615oiv.3.2022.05.11.06.23.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 May 2022 06:23:48 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-5255-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:4040:4f00::1 as permitted sender) client-ip=2604:1380:4040:4f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HhZX3O5n; spf=pass (google.com: domain of mptcp+bounces-5255-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:4040:4f00::1 as permitted sender) smtp.mailfrom="mptcp+bounces-5255-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by da.mirrors.kernel.org (Postfix) with ESMTPS id 674562E09A0 for ; Wed, 11 May 2022 13:23:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD33528FF; Wed, 11 May 2022 13:23:46 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E3DA28F9 for ; Wed, 11 May 2022 13:23:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652275423; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6S2w0/50GdrBpJkkutTW0xko0umxmLnFBJfJW9sJDGQ=; b=HhZX3O5nQeZ0h+FEm4hDCGg+HlUXpldLcz2whVgUH/t4Ud6mBAqrGozbzkfcjU6dFDPLmz pNv1TmX68rAZpUQLDxgfzCjmyW9PKIP0BBWU8sNal+3JhKsw5Zjq6nn2z6vmCmMWMYwBPW gjmKxoHa5LddH/K0SuijvXMaPyQ5P9I= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-630-3yQypZZzNRmhuUnFPK_4nw-1; Wed, 11 May 2022 09:23:35 -0400 X-MC-Unique: 3yQypZZzNRmhuUnFPK_4nw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D878F800882 for ; Wed, 11 May 2022 13:23:34 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.194.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5D0ED43F705 for ; Wed, 11 May 2022 13:23:34 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-next] mptcp: stop using the mptcp_has_another_subflow() helper Date: Wed, 11 May 2022 15:23:30 +0200 Message-Id: <5e05ab9275671ea3018eaa02028197817715de65.1652275377.git.pabeni@redhat.com> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pabeni@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8"; x-default="true" The mentioned helper requires the msk socket lock, and the current callers don't own it nor can't acquire it, so the access is racy. All the current callers are really checking for infinite mapping fallback, and the latter condition is explicitly tracked by the relevant msk variable: we can safely remove the caller usage - and the caller itself. The issue is present since MP_FAIL implementation, but the fix only applies since the infinite fallback support, ence the somewhat unexpected fixes tag. Fixes: 0530020a7c8f ("mptcp: track and update contiguous data status") Signed-off-by: Paolo Abeni Reviewed-by: Mat Martineau --- net/mptcp/pm.c | 2 +- net/mptcp/protocol.h | 13 ------------- net/mptcp/subflow.c | 3 +-- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 59fdab2d0c27..8ba51120f35b 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -303,7 +303,7 @@ void mptcp_pm_mp_fail_received(struct sock *sk, u64 fai= l_seq) =20 pr_debug("fail_seq=3D%llu", fail_seq); =20 - if (mptcp_has_another_subflow(sk) || !READ_ONCE(msk->allow_infinite_fallb= ack)) + if (!READ_ONCE(msk->allow_infinite_fallback)) return; =20 if (!READ_ONCE(subflow->mp_fail_response_expect)) { diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index f98c27300e60..dbb914def5cc 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -661,19 +661,6 @@ static inline void mptcp_subflow_tcp_fallback(struct s= ock *sk, inet_csk(sk)->icsk_af_ops =3D ctx->icsk_af_ops; } =20 -static inline bool mptcp_has_another_subflow(struct sock *ssk) -{ - struct mptcp_subflow_context *subflow =3D mptcp_subflow_ctx(ssk), *tmp; - struct mptcp_sock *msk =3D mptcp_sk(subflow->conn); - - mptcp_for_each_subflow(msk, tmp) { - if (tmp !=3D subflow) - return true; - } - - return false; -} - void __init mptcp_proto_init(void); #if IS_ENABLED(CONFIG_MPTCP_IPV6) int __init mptcp_proto_v6_init(void); diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index b38a02db924b..550c8fbec54d 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1218,8 +1218,7 @@ static bool subflow_check_data_avail(struct sock *ssk) if (!__mptcp_check_fallback(msk)) { /* RFC 8684 section 3.7. */ if (subflow->send_mp_fail) { - if (mptcp_has_another_subflow(ssk) || - !READ_ONCE(msk->allow_infinite_fallback)) { + if (!READ_ONCE(msk->allow_infinite_fallback)) { ssk->sk_err =3D EBADMSG; tcp_set_state(ssk, TCP_CLOSE); subflow->reset_transient =3D 0; --=20 2.35.3