From patchwork Tue Jul 4 20:44:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 115893 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp1452072vqx; Tue, 4 Jul 2023 13:46:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlHqJzTEzOG1b8nMmRwou+NUcPdA7snFiSqvddpL+kHBcAprZ94FHyTBjnCZlKRwwONSiIRi X-Received: by 2002:a17:90a:c584:b0:259:a7a6:26f9 with SMTP id l4-20020a17090ac58400b00259a7a626f9mr329984pjt.21.1688503562424; Tue, 04 Jul 2023 13:46:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688503562; cv=none; d=google.com; s=arc-20160816; b=Jvwn9dWDh7cw/W6ejbNXordEZCMEszRpukpLNBYJl+7/TACBZbrCGl7V/XWXmSXyHY xeUh3YmqPAdDu1kABlySVwLqq1jQd0gEEr4IVM/TR6F7/D7HGeVK+SGHmqT5LSxoDLYS edSQLvr8Zh4uxeQsIPkCTt3bk48Ewy0iCmAa51HUj2Vzd3j9W4+GYIViJrJkMtJy8Zul 4YOjJysWX+CmDxYkkoi8Sr0oIxS2EfWjaUnasU2QwAlU7ZiwQZKKa8nL3nuUGcTY8T3e KD0wlQ5VDwhbRi4zZh5r4BA2O1OlYJoK8HE837DCjgJxSwBCzIf9LmToNem7dXlt6Psu Y0Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=Q9+vtbDr/83fQnYq7vQfS8obpzLNRgRXKiB0wIBmyH0=; fh=dwGQIv9hBuwpIyw5J5filTZo0jFzByE6GAwByOAQtIs=; b=mNPzMXZnOYcsTOrdSFdfpiu/vD8XiVV7Ukv7DsarvBELtw30/vwtbsnW3JB9z3ww3E mbWOSzCfrQ7j5ivO7ZcvDXPxRubPOt5AeiOnlv9SzNj0ZeYb76Sb39Hl7f/YmqNpdB9Y lzVQN2/totuAKpPVX7IvvOjf7EKBkh5IPwTn3yZCbNHx4rZsu/bc5mge61LkWHT0nZU9 q94hVUOgITTGKjRbPzTP52AQezvnmMCexCAVQuqEABKSuJm7n5pNbT+mDS3JmyA+G1Cx Pap99jonzrT5SyLY2XFQSygqyHKZCF4NWXwHRqX6B9k5W7BwZqOxNsVCLC/CQNLDXnF8 5QgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=dDcIwKrx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=tessares.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l9-20020a17090a850900b0026305080a6fsi94181pjn.63.2023.07.04.13.45.50; Tue, 04 Jul 2023 13:46:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=dDcIwKrx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=tessares.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231436AbjGDUpA (ORCPT + 99 others); Tue, 4 Jul 2023 16:45:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231367AbjGDUo4 (ORCPT ); Tue, 4 Jul 2023 16:44:56 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 225D810E9 for ; Tue, 4 Jul 2023 13:44:55 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fb4146e8ceso73162595e9.0 for ; Tue, 04 Jul 2023 13:44:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; t=1688503493; x=1691095493; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Q9+vtbDr/83fQnYq7vQfS8obpzLNRgRXKiB0wIBmyH0=; b=dDcIwKrxO+HEq9ri/Cq6iieSfRxEKcKW4RwIVnf3DXJZpfr2p9BB2lzfQ8tHsaItOd MvUD5fRsKgQsDGk+pYer9hH84a90D2cibTDaVtGQssa9gpBmTwwLaYhUqtzZwgYNmxxn oR8GQxHrq8QvUBPYICwr5TvF2f63HIXmIH8IAlgwy2rKhuzUlmrhKs2OqQo1knReekkh +5tOjzW4OZdWTWODHSaL+f8IOatR9FyzB/wlGd3KwAEZCU4/QC/DrLzoB1VhOD7x/CSZ 8SxYBdg4lXjzA7/WQwQSQ4mbbi9MJEbFzeG7FoB8PbiLPGO2ZNzG7ksaz4eyeP1hPsI2 /WkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688503493; x=1691095493; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q9+vtbDr/83fQnYq7vQfS8obpzLNRgRXKiB0wIBmyH0=; b=i8oxGPJ5byBBHvYJf+mLEn6Gt6UoH/MrKljQDpXtpo+uT4bScXxN93Q+mqKrsT+pme R99jq4lH6w9XIcc13CJxfN6zQswjc/JfXYhjFHVNLrBRwbSiQfW3YQ2JcIy5881YUJ8i jeHuFpSChHSte6yastMhr6xS1y8uqDX2m1BA5PctSIkHvaYMka7YhjXarGnmRqR+qo4X guUL08foNrMMhGS+NvRSZZWcaKhgJcXvY3eX5cXnHkmPs7a1ER0igPyVjZZZS79HVkwi 8m7EEae5ngVY8zITVoLM6cOFRxqMp4RLN3l7Vdfu9Z/eje6qHvjq+8WEbm6sBs1ridHb NUDg== X-Gm-Message-State: AC+VfDxWSQRrLmNJXKhgmiTSsuwb65pqE6i3sTITr3TD8NL/C9AGaVN5 qfMtYZmIex0+yI147ELLAqBWQQ== X-Received: by 2002:a05:600c:24d:b0:3f7:f884:7be3 with SMTP id 13-20020a05600c024d00b003f7f8847be3mr11702546wmj.4.1688503493621; Tue, 04 Jul 2023 13:44:53 -0700 (PDT) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id y4-20020a05600c364400b003fa74bff02asm115332wmq.26.2023.07.04.13.44.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 13:44:53 -0700 (PDT) From: Matthieu Baerts Date: Tue, 04 Jul 2023 22:44:33 +0200 Subject: [PATCH net 1/9] mptcp: ensure subflow is unhashed before cleaning the backlog MIME-Version: 1.0 Message-Id: <20230704-upstream-net-20230704-misc-fixes-6-5-rc1-v1-1-d7e67c274ca5@tessares.net> References: <20230704-upstream-net-20230704-misc-fixes-6-5-rc1-v1-0-d7e67c274ca5@tessares.net> In-Reply-To: <20230704-upstream-net-20230704-misc-fixes-6-5-rc1-v1-0-d7e67c274ca5@tessares.net> To: mptcp@lists.linux.dev, Mat Martineau , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Florian Westphal , Kishen Maloor Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Matthieu Baerts , stable@vger.kernel.org X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1193; i=matthieu.baerts@tessares.net; h=from:subject:message-id; bh=78yDWCcA8nZMCwaJymS1SUQrRgt/rwieryZs2j/mBnQ=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBkpITDTTJdrfCKEn0rRGWIZvU/RbuXBa0c61Ver f1XK72qPSKJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZKSEwwAKCRD2t4JPQmmg c3OED/4yrhdxKWXDzRsPfRLPgPa5JSSeswZ5hDKLF8OS5fBmwoSdJdwsr3QS2cVZZ6pNudKf3En 1IFzsMVNZmQxJPzJsens5nkKdp+++70BSMP+td5jpugtM6lj/xAHtjEBdxVnJqS7zaXFzs7Fqo/ AlUYpsiBK/kvqK9rsyxHoygepYVFHi3Wi2drfzJISvEc2dqBxfVaEgr0QNSk9gBBRQNAIidt8Qo 4FaP6D6pcDtcTGDLHBygt6zWt0dscev9L4LonP/ot4WJG2WX/1a+UXKmiCJKZjNPPfLB5MmX9ef kEhsaD1q5HB27+6yQXqFqYA0oBp1QN+bfoKFgbO1yk3X2XXojtvliebBTA3Lb5viA0nrMp9EKR9 GZ5cKuZIe+dtY9WnjWV3j7C2I2Z5r5Hq64P9LJUXAuWalpDw2fetRPZQ9ykcBhgt5Th3ZN7u9/2 HI3Z3E3KvDsJWKE9h4dQXggYe1rqNvb9DCoZSE5zAX1qk4sohtZnIL1EHHeNceeRo5nUoxYCh8Z pCJ5iFOdblW4MVMPLRz4ns+JX80nqFnzgQj09Po0hM/saBgiYTV/RQJq2dgUL1g0LLKopNl/ouG 3DFLTYj2Tr70Eouhwm6E5KldqAuRbT9L2g4bM7ukSEUXJ7/E0hZz6HwaAKANcmcJsWXAEaZjGZM GwEc0r1z/3YRP/g== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770524311565164546?= X-GMAIL-MSGID: =?utf-8?q?1770524311565164546?= From: Paolo Abeni While tacking care of the mptcp-level listener I unintentionally moved the subflow level unhash after the subflow listener backlog cleanup. That could cause some nasty race and makes the code harder to read. Address the issue restoring the proper order of operations. Fixes: 57fc0f1ceaa4 ("mptcp: ensure listener is unhashed before updating the sk status") Cc: stable@vger.kernel.org Signed-off-by: Paolo Abeni Reviewed-by: Matthieu Baerts Signed-off-by: Matthieu Baerts --- net/mptcp/protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index e892673deb73..489a3defdde5 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2909,10 +2909,10 @@ static void mptcp_check_listen_stop(struct sock *sk) return; lock_sock_nested(ssk, SINGLE_DEPTH_NESTING); + tcp_set_state(ssk, TCP_CLOSE); mptcp_subflow_queue_clean(sk, ssk); inet_csk_listen_stop(ssk); mptcp_event_pm_listener(ssk, MPTCP_EVENT_LISTENER_CLOSED); - tcp_set_state(ssk, TCP_CLOSE); release_sock(ssk); }