Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2161818iof; Tue, 7 Jun 2022 21:49:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhsQCtIjyHCOK7VgVFlKrQ+Ms5cBU4/ZOR2NNTlprTdsSAd/JZ05EJ/qK5XZqsL3wnZCUz X-Received: by 2002:a62:2701:0:b0:518:2570:b8f6 with SMTP id n1-20020a622701000000b005182570b8f6mr32698311pfn.19.1654663749245; Tue, 07 Jun 2022 21:49:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654663749; cv=none; d=google.com; s=arc-20160816; b=qp5L7kHi6eSGhSkgrlBbvgxh1aqLi7iYaGA5ClBqjljXqRi997caM9EhahZyBeiFiN MGdTgnhhpeOuo35fCj2bvfWLoDqRjX6m2BbHMCAtcWp56nZR1wAB5GBWLoE8SgLFv4VN 2B4fpjht0vDiqmsY64AUSSJcLFUB3YCmsH5wfcaqGDDDSEn63RLfC52q88XGCUdrZH2x zMyeknPBHRH2VY6GsWGw8QEuJKcxcea9HMNMkSzt2yMlv3aqeKpASKMVVKgRriMZodD9 UO6QpCT1gz/+GvAbfBfegFt0WZszCKsa2BFUkiejlqMtw7Q4q+juzPLR7z0CuSVMg1/X 8x6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bHpO/iDkqc8YQqh5aP22TceNaOvyP8KDR0xeH9TkOQ0=; b=0kN0nSZkyUEVqCI8/Ryq0ksqCJh3UIbkmdqbc3NHxFcKrdQhb3D+65a/djgFngwAlm nPSfjMVP6x0bkqAVBp3ENVk3gPiE71ua+zo0VisctgxHPyI+AlToKEB23eePnd2rysRS o+XMWAzmYUzR7jtf4Q+n9wk1AhWio3SnHEoLaLiMvAWdDMgxk3/JhNp3SH5B3H53ofBZ oGgPn0sshNAjU1qYwCInq5QGnHCCWwNKidlzKXPugVNSLGtxotlgQxiPcvACDaOyoD+R shrU6TLU7XtWPLRdOFrcwkaXQ+J8NGD+yy0yA9vYJSlZKfgwSJPfJ0Xry2oRQuR6gkdI nsBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WIM32K0r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n13-20020a170902e54d00b00164164c5a4csi30360889plf.91.2022.06.07.21.49.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:49:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WIM32K0r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9E94D3724B7; Tue, 7 Jun 2022 21:19:20 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381856AbiFGW2n (ORCPT + 99 others); Tue, 7 Jun 2022 18:28:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378479AbiFGVTC (ORCPT ); Tue, 7 Jun 2022 17:19:02 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E818322445B; Tue, 7 Jun 2022 11:59:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 6552CCE247C; Tue, 7 Jun 2022 18:59:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B74AC34115; Tue, 7 Jun 2022 18:59:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628349; bh=xTzq9ap8H1ICIVQA5jMVvngsvaOqHvDOplS/ac4gl0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WIM32K0rdFBwyTgb5Il7mZYdtZemxx93fo0MSthl6NB9n4IkvI4pf5kTSfbtzEgIJ 86XUgObFJALV+I2/nDmyNyN6sNfxHEjmopO/bxSLululXf6f7VAwiSysAnQTDYHkq0 X3qfCfhTo3t+qN04NcmoXB5+efQk/1yZ3XSWCIcM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Davide Caratti , Paolo Abeni , Mat Martineau , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 298/879] mptcp: reset the packet scheduler on incoming MP_PRIO Date: Tue, 7 Jun 2022 18:56:56 +0200 Message-Id: <20220607165011.497008039@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Paolo Abeni [ Upstream commit 43f5b111d1ff16161ce60e19aeddb999cb6f0b01 ] When an incoming MP_PRIO option changes the backup status of any subflow, we need to reset the packet scheduler status, or the next send could keep using the previously selected subflow, without taking in account the new priorities. Reported-by: Davide Caratti Fixes: 40453a5c61f4 ("mptcp: add the incoming MP_PRIO support") Signed-off-by: Paolo Abeni Signed-off-by: Mat Martineau Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/mptcp/pm.c | 19 +++++++++++++++---- net/mptcp/protocol.c | 2 ++ net/mptcp/protocol.h | 1 + 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index aa51b100e033..4d6a61acc487 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -261,14 +261,25 @@ void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, spin_unlock_bh(&pm->lock); } -void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup) +void mptcp_pm_mp_prio_received(struct sock *ssk, u8 bkup) { - struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + struct sock *sk = subflow->conn; + struct mptcp_sock *msk; pr_debug("subflow->backup=%d, bkup=%d\n", subflow->backup, bkup); - subflow->backup = bkup; + msk = mptcp_sk(sk); + if (subflow->backup != bkup) { + subflow->backup = bkup; + mptcp_data_lock(sk); + if (!sock_owned_by_user(sk)) + msk->last_snd = NULL; + else + __set_bit(MPTCP_RESET_SCHEDULER, &msk->cb_flags); + mptcp_data_unlock(sk); + } - mptcp_event(MPTCP_EVENT_SUB_PRIORITY, mptcp_sk(subflow->conn), sk, GFP_ATOMIC); + mptcp_event(MPTCP_EVENT_SUB_PRIORITY, msk, ssk, GFP_ATOMIC); } void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 2a9335ce5df1..8f54293c1d88 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -3102,6 +3102,8 @@ static void mptcp_release_cb(struct sock *sk) __mptcp_set_connected(sk); if (__test_and_clear_bit(MPTCP_ERROR_REPORT, &msk->cb_flags)) __mptcp_error_report(sk); + if (__test_and_clear_bit(MPTCP_RESET_SCHEDULER, &msk->cb_flags)) + msk->last_snd = NULL; } __mptcp_update_rmem(sk); diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 5655a63aa6a8..9ac63fa4866e 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -124,6 +124,7 @@ #define MPTCP_RETRANSMIT 4 #define MPTCP_FLUSH_JOIN_LIST 5 #define MPTCP_CONNECTED 6 +#define MPTCP_RESET_SCHEDULER 7 static inline bool before64(__u64 seq1, __u64 seq2) { -- 2.35.1