From nobody Thu Sep 18 08:03:44 2025 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:35eb:0:0:0:0:0 with SMTP id w11csp62550uau; Fri, 17 Jun 2022 03:06:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vYp92PPYIl0js8kJATrzYxzDGLKJppx5Er7P2AyeMNfabzarxYh+c5Jg06P8ra/1Z8n+1b X-Received: by 2002:a05:6870:c181:b0:f1:ea2f:f7f7 with SMTP id h1-20020a056870c18100b000f1ea2ff7f7mr10701415oad.18.1655460411025; Fri, 17 Jun 2022 03:06:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655460411; cv=none; d=google.com; s=arc-20160816; b=XTulnQ3doYmBCywfRkMp/n+maGfc6B1izCBvR/sMwq+zWjc5d29ESUvrKA/wBUj5Cs JnPHbQLZ+q6UHaYyVBgfzGqwmOh4ThgvXiMVFbY58/CsBdxgn/aPCCakUzfI1K5smTF6 CVYJrqBWBmWVe4KEvQwagAf5boAfiJ0wL+THQnrmFn/3zSFWWnNUAbf6X8lUlzi3GI8Z 4bGYNsLUkk5h5GjUm3pVun8xw4EQhxaqBmPEW+NpY1mxEhPKRRcJlA7IDOaeaU1wbAKZ ysaIAEkB/IkLxKG10lyPVRPSy/TvSOdndwa59ycAIjVAWvda40eDquqFDs52gU4VBio9 KJbA== 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:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=9idqIOEQPfFgt+AW6bj48dhUJzMqwGEZ9BnPT1+Jl8I=; b=Pc5KhILWnoIDmBCCHgd4ajBhlF4Xb/UqO+FCNHStxyNAgyJPS00HfNJs5Ukid6bxau +Id7WrsakKrWISw9nOden4K2e3pNYOPNcMtRoGnhuoSwwJihO/LlhBAYu9F5Xr0zE4lk Z1jYzi+OF11jLwdqHhyJxMpYfQCmJLuhAxoBVh7uBDboRcZ5dQDEljK7HGrCKoQiFlqz rJpeGlrhwq+zyk7kY4NXtIuakqH3XU9FMYqcMnXTieK+zC1pGHUaz5mq4JlqQfE32Xof mP9s0CK/oWog+jn+pfCM8tgNLYN6dFbZMvtBrUtgR2gk2bt82hYpEHgOh5DWHiYSlFdo Aaag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fyWTXwU6; spf=pass (google.com: domain of mptcp+bounces-5689-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.84.19 as permitted sender) smtp.mailfrom="mptcp+bounces-5689-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. [139.178.84.19]) by mx.google.com with ESMTPS id m188-20020aca58c5000000b0032e879825ecsi3473557oib.116.2022.06.17.03.06.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jun 2022 03:06:51 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-5689-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.84.19 as permitted sender) client-ip=139.178.84.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fyWTXwU6; spf=pass (google.com: domain of mptcp+bounces-5689-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.84.19 as permitted sender) smtp.mailfrom="mptcp+bounces-5689-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 D89EF2E0A25 for ; Fri, 17 Jun 2022 10:06:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A61D22F36; Fri, 17 Jun 2022 10:06: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 46A1A2F25 for ; Fri, 17 Jun 2022 10:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655460404; 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: in-reply-to:in-reply-to:references:references; bh=9idqIOEQPfFgt+AW6bj48dhUJzMqwGEZ9BnPT1+Jl8I=; b=fyWTXwU6DHdPwsra0mKcvJzn5sBixCBMkdknc9SUFGz3eSco2KXA4y2qBWDbZSH/ddQ/CN emuAX1DduIqEEHuKPf3yWzJiZkaRL0lLR3n+BQhLqfA3lWEb8sDp+GdlFC6vXY/xOBGU/4 1k2ZFZh4HjC0IcMmL//mlB7XZvHKegc= 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-114-grHrKqZZONmB79uMCDzElg-1; Fri, 17 Jun 2022 06:06:43 -0400 X-MC-Unique: grHrKqZZONmB79uMCDzElg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C215385A580 for ; Fri, 17 Jun 2022 10:06:42 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.194.194]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C23740C1288 for ; Fri, 17 Jun 2022 10:06:42 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-net v3 5/6] mptcp: consistent map handling on failure Date: Fri, 17 Jun 2022 12:05:19 +0200 Message-Id: In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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" When the MPTCP receive path reach a non fatal fall-back condition, e.g. when the MPC sockets must fall-back to TCP, the existing code is a little self-inconsistent: it reports that new data is available - return true - but sets the MPC flag to the opposite value. As the consequence read operations in some exceptional scenario may block unexpectedly. Address the issue setting the correct MPC read status. Additionally avoid some code duplication in the fatal fall-back scenario. Fixes: 9c81be0dbc89 ("mptcp: add MP_FAIL response support") Signed-off-by: Paolo Abeni --- net/mptcp/subflow.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index b157e275315e..1e182301e58b 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1252,17 +1252,12 @@ static bool subflow_check_data_avail(struct sock *s= sk) subflow->send_mp_fail =3D 1; =20 if (!READ_ONCE(msk->allow_infinite_fallback)) { - ssk->sk_err =3D EBADMSG; - tcp_set_state(ssk, TCP_CLOSE); subflow->reset_transient =3D 0; subflow->reset_reason =3D MPTCP_RST_EMIDDLEBOX; - tcp_send_active_reset(ssk, GFP_ATOMIC); - while ((skb =3D skb_peek(&ssk->sk_receive_queue))) - sk_eat_skb(ssk, skb); - } else { - mptcp_subflow_fail(msk, ssk); + goto reset; } - WRITE_ONCE(subflow->data_avail, MPTCP_SUBFLOW_NODATA); + mptcp_subflow_fail(msk, ssk); + WRITE_ONCE(subflow->data_avail, MPTCP_SUBFLOW_DATA_AVAIL); return true; } =20 @@ -1270,10 +1265,14 @@ static bool subflow_check_data_avail(struct sock *s= sk) /* fatal protocol error, close the socket. * subflow_error_report() will introduce the appropriate barriers */ - ssk->sk_err =3D EBADMSG; - tcp_set_state(ssk, TCP_CLOSE); subflow->reset_transient =3D 0; subflow->reset_reason =3D MPTCP_RST_EMPTCP; + +reset: + ssk->sk_err =3D EBADMSG; + tcp_set_state(ssk, TCP_CLOSE); + while ((skb =3D skb_peek(&ssk->sk_receive_queue))) + sk_eat_skb(ssk, skb); tcp_send_active_reset(ssk, GFP_ATOMIC); WRITE_ONCE(subflow->data_avail, MPTCP_SUBFLOW_NODATA); return false; --=20 2.35.3