From nobody Mon Feb 9 04:41:06 2026 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:cbb9:0:0:0:0:0 with SMTP id v25csp613265jap; Thu, 9 Dec 2021 09:30:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpdspbEL4KArb1kqZJA61FKWLKPqYZm0qq4vq4HMbDE/CLK8nYiDrrzB1pq6jOcRLlyN35 X-Received: by 2002:a05:622a:95:: with SMTP id o21mr19449973qtw.386.1639071056609; Thu, 09 Dec 2021 09:30:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639071056; cv=none; d=google.com; s=arc-20160816; b=z7/yzGTq1sTKkdT9RbPTXHvNYHW0CYSQuVMSn2Oq5eYV00LdxDrrSlF/NTiyKs2DBQ HJTsHhsNnIeufBIKTjv9RZXbNHQmTr13Z5sD6h9uiUcnDT9T9ME6pkTe8jRwbpJj3vfZ UXP5eAUtp++WJufnM0/Q1qLMGNYDwqrsjhISmOvHIdvigy9iQvgVxN8ff/Wf8iebqtob ut2NZYgpSZLpQ7H4vbVykCEZoE/BLnVsKo0F7UsSRVPP/84JxCOCJ79qFatW3XaS4Zve x5T2eo1sgnx5NmrKWYt0BUXxvJ870589wZfcWU7PkgKbXHgM5Hy1tJucEc7oI+7H+Zuj r0EA== 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=aMR1hYkvoUwefVKooQD8Jdkgq7b6DI69kqlt/t+9Rd8=; b=YTenyHAyrWl7muhqEbMeh1qf1AAX+isJg+xYpjm/756Zu5VEBuDs0bi/ntokOlfiYu wu3W1xckOPDV+C4cRkxot2wKCN65RobU/Q3yXhFXoVCOJhPZyahnYXY00CNtiglM2/uq OAwLh8mGvOgf/PpMt7vULtGXM9J8Xxji1921tcY13Wslw2V/r3cTV8mZe0Iz3BdpEWjp ivMGYNn5AuinDmIEEyzBorHqb3IMzOITq9IzzJ/NVy8vXj0OnThqDfIz3i1pbZUGWY+e QgB9ndjY2Hp+jzk10AZXovqolADI+LGE+G8PM3QTeR7k1BKetuT3ygTcZTrOPbsUMBXT U+iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Yd1/537a"; spf=pass (google.com: domain of mptcp+bounces-2701-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2701-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [2604:1380:1000:8100::1]) by mx.google.com with ESMTPS id c13si389757qtb.778.2021.12.09.09.30.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Dec 2021 09:30:56 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-2701-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) client-ip=2604:1380:1000:8100::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Yd1/537a"; spf=pass (google.com: domain of mptcp+bounces-2701-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2701-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 sjc.edge.kernel.org (Postfix) with ESMTPS id EC4093E0F00 for ; Thu, 9 Dec 2021 17:30:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ADB332C9E; Thu, 9 Dec 2021 17:30:53 +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.129.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 EB4A02C80 for ; Thu, 9 Dec 2021 17:30:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639071051; 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=aMR1hYkvoUwefVKooQD8Jdkgq7b6DI69kqlt/t+9Rd8=; b=Yd1/537aMtV3zeoUKWuLRkiiXv4tnyeMn8Etwi0Q8/FcAVW7R4l16OLirSIRP6Ag93DsVt faBISMaYmpU86UJ3FVAP+i6FeTn5wUqMyDtz5S+XzwHbGfymB2ne1EqtPhEkiYLK5vobu0 7ra212NNP14UJWR0P7iyviE5lYNWfKg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-27-ZGjfGL4BPIKO4tAb-OWM5Q-1; Thu, 09 Dec 2021 12:30:49 -0500 X-MC-Unique: ZGjfGL4BPIKO4tAb-OWM5Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EE04014754 for ; Thu, 9 Dec 2021 17:30:48 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.194.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B92D5ED2C for ; Thu, 9 Dec 2021 17:30:48 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-next v5 1/5] mptcp: fix per socket endpoint accounting. Date: Thu, 9 Dec 2021 18:30:38 +0100 Message-Id: <48503581612e8e8c39ab21b56d069a1170093fc1.1639070864.git.pabeni@redhat.com> 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.79 on 10.5.11.14 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" Since full-mesh endpoint support, the reception of a single ADD_ADDR option can cause multiple subflows creation. When such option is accepted we increment 'add_addr_accepted' by one. When we received a paired RM_ADDR option, we deleted all the relevant subflows, decrementing 'add_addr_accepted' by one for each of them. We have a similar issue for 'local_addr_used' Fix them moving the pm endpoint accounting outside the subflow traversal. Fixes: 1a0d6136c5f0 ("mptcp: local addresses fullmesh") Signed-off-by: Paolo Abeni --- net/mptcp/pm_netlink.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 3186d33b5208..d18b13e3e74c 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -710,6 +710,8 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp= _sock *msk, return; =20 for (i =3D 0; i < rm_list->nr; i++) { + bool removed =3D false; + list_for_each_entry_safe(subflow, tmp, &msk->conn_list, node) { struct sock *ssk =3D mptcp_subflow_tcp_sock(subflow); int how =3D RCV_SHUTDOWN | SEND_SHUTDOWN; @@ -729,15 +731,19 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mpt= cp_sock *msk, mptcp_close_ssk(sk, ssk, subflow); spin_lock_bh(&msk->pm.lock); =20 - if (rm_type =3D=3D MPTCP_MIB_RMADDR) { - msk->pm.add_addr_accepted--; - WRITE_ONCE(msk->pm.accept_addr, true); - } else if (rm_type =3D=3D MPTCP_MIB_RMSUBFLOW) { - msk->pm.local_addr_used--; - } + removed =3D true; msk->pm.subflows--; __MPTCP_INC_STATS(sock_net(sk), rm_type); } + if (!removed) + continue; + + if (rm_type =3D=3D MPTCP_MIB_RMADDR) { + msk->pm.add_addr_accepted--; + WRITE_ONCE(msk->pm.accept_addr, true); + } else if (rm_type =3D=3D MPTCP_MIB_RMSUBFLOW) { + msk->pm.local_addr_used--; + } } } =20 --=20 2.33.1