Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3602981pxb; Mon, 24 Jan 2022 13:16:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCNdk7lTtyh9rkV3HuhYLL0OzSEn8tCt81ajXXj+PGD2SOLgzzVysOdOjzL6lsvrqATDRk X-Received: by 2002:a17:90b:224a:: with SMTP id hk10mr143408pjb.89.1643059019382; Mon, 24 Jan 2022 13:16:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643059019; cv=none; d=google.com; s=arc-20160816; b=LqC6Eq7mq+nHu68RtNLfCTkHu4vghi9Td6vXaKt8qWF4H+D7P3eY9ZCMpq5F0y2lqH b91lxQkk4xy6dlxjJaneKsUofSfey2EYQqGmLhPFuoKdkASFkJddFqaC5eJI/tRatyTg yPjpQ51o5w3U2gWPziTri1iHo2yxzFol9A9jJahNnYnmR4UUW4UutzKh2Qj2mwcoU4Z7 q/birw+iZEWL2M2FLWMvnnBJGvWoYJmebgktLaLDP6xOONJPw5SQTw9yq8bRS9k8Z9dK /3cq2bTZds9fdtr568FzIlRg4L7F8nFqCytNnFyGIddnr0gO1XzHoeOGGZBLJVtI4ccJ g5ew== 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=X7mfaJ9kIcinBVOtzGqopHo9X3bocvTZa9EDzMufcGw=; b=CbCO3czFgsbbfus79e5ldtGAeLerutUdJU4GbAL7jK0F4ybDLSmn3AxPrzU3LzAZUN UHidLujqBUs8HonBk9/CcQw+rfH4Ev9gZn48nw1PZhtp55YDEYhyl5PwFMFZkni8MBO+ dubkkUBFUht0IuQ9Qgbxgdf/AZ8FvSFb9wEsQjGh+05xm1i88pw4N7lhd5MOG53h/0/S TbuTB8Dj/57Z13WPJJhIshMj2GAk0XVrqexKtiZwOAXoRP/mj+fViFBFiN1R+s2QCqPj pf+xsrEx3G5dKkDU4PEhp++GSISsZ6JMUNwdnQIR/Dry+Ih53p/nkn91MGOOuuQTXYOR PTZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="O/Rm6Ai2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z19si13847660plb.264.2022.01.24.13.16.46; Mon, 24 Jan 2022 13:16:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="O/Rm6Ai2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1392227AbiAXUut (ORCPT + 99 others); Mon, 24 Jan 2022 15:50:49 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:33540 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383516AbiAXU1U (ORCPT ); Mon, 24 Jan 2022 15:27:20 -0500 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 ams.source.kernel.org (Postfix) with ESMTPS id B2831B811FB; Mon, 24 Jan 2022 20:27:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9770C340E5; Mon, 24 Jan 2022 20:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056037; bh=hk/eP+4vdEUObKkcLaViDp0mx6G5Xhs2R8ms/YVjohw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O/Rm6Ai2tD7Z5g8uttA4Wtr952JiYenWDtgDmvU4iesIwNrX5wo4eV8zLAmWGWaVN FAjmlYcQojlq6OtOjxkiaAZeCAtRcgiSriTPhzPyXsU1OoAByklzZdFrQilCa3sSDZ Ecf+7Ige6kSuZ7xrcD2Y8PafQ3TGxB6z5nNcs7dM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthieu Baerts , Mat Martineau , "David S. Miller" , Sasha Levin , Geliang Tang Subject: [PATCH 5.15 349/846] mptcp: fix opt size when sending DSS + MP_FAIL Date: Mon, 24 Jan 2022 19:37:46 +0100 Message-Id: <20220124184112.995825032@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthieu Baerts [ Upstream commit 04fac2cae9422a3401c172571afbcfdd58fa5c7e ] When these two options had to be sent -- which is not common -- the DSS size was not being taken into account in the remaining size. Additionally in this situation, the reported size was only the one of the MP_FAIL which can cause issue if at the end, we need to write more in the TCP options than previously said. Here we use a dedicated variable for MP_FAIL size to keep the WARN_ON_ONCE() just after. Fixes: c25aeb4e0953 ("mptcp: MP_FAIL suboption sending") Acked-and-tested-by: Geliang Tang Signed-off-by: Matthieu Baerts Signed-off-by: Mat Martineau Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/mptcp/options.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 0966855a7c251..f69a1cadb13fc 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -823,10 +823,13 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, if (mptcp_established_options_mp(sk, skb, snd_data_fin, &opt_size, remaining, opts)) ret = true; else if (mptcp_established_options_dss(sk, skb, snd_data_fin, &opt_size, remaining, opts)) { + unsigned int mp_fail_size; + ret = true; - if (mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) { - *size += opt_size; - remaining -= opt_size; + if (mptcp_established_options_mp_fail(sk, &mp_fail_size, + remaining - opt_size, opts)) { + *size += opt_size + mp_fail_size; + remaining -= opt_size - mp_fail_size; return true; } } -- 2.34.1