Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3634890pxb; Mon, 24 Jan 2022 14:03:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJwTwiS5OWq4iWQbEruFap6TAtb4ufYKQ5+DNUB3Xz9nSocFQfEAY2bphgPqhm4EXD+rGd6t X-Received: by 2002:a63:82c1:: with SMTP id w184mr1917674pgd.200.1643061820410; Mon, 24 Jan 2022 14:03:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643061820; cv=none; d=google.com; s=arc-20160816; b=kL48YroCu3SQVG4C2iDbwCt+MNvdHm6fS6BPoEcY6Zl8j7yOFC2P0ZBKLk+Q1FKaVR pWbthVmUmd4Qy5egsTsaqVXGnI+GRStCkanMKSlcZNQGeqrIvjCjzjb5AUjZCedtfdvu 5wT9VnrBNiByCpukFhjPAMbkTubABryHcppS297usbgS5xhZ9PgmjQrCH3NKo3IRhOPO WQLkEAMBj2UdtVV/gQtkolI4AL0a6R040wcoRrC0DaksvNdR+D3aVG4/ugT1LYIr6uTY SzIDvf/pNJoWyWy8mzILM84ZfpaWn6LVQqTWkP6DvE10OfeH7DFgMrGxi/0myefj6D42 lJZg== 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=K3dNEKj2RJGPewFnccrd0830pZGX/oFoeOGiEPpQ64Q=; b=Sl8mvUBkCh/Q+4Te/jqypaVjY9HMOKrFLIH2dczr8B43sk6yHLFWdrSzuSBkNClIDH K1lYfFtbvEKJxYfR+eHVhphuhXqdpXfmCooRWMcX5q9FINnfEqrhST07fECMpYjn4Kup GIPBZ1w+iyz1NDMSmnjztQjqLFw4zTP/TF24bCh2pOjhHJ+b0riE+c0K82lxRNitpEbi +QYtk4pF6dN+BUzdqMoX2+cQ81MrLpiEtVdBBlP4610THLT4oPH0xuRKvFv5nbGniHNj hgVBxzpcnUVX9UAQynjcYf99AfMR/YXQQyk5zxaSNT6JJxYUStFVhUAEGuVmcG37oKe3 jiUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qchwmpts; 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 r3si13699559pff.365.2022.01.24.14.03.28; Mon, 24 Jan 2022 14:03:40 -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=qchwmpts; 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 S1574829AbiAXVua (ORCPT + 99 others); Mon, 24 Jan 2022 16:50:30 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35284 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448850AbiAXVN7 (ORCPT ); Mon, 24 Jan 2022 16:13:59 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 9713F61469; Mon, 24 Jan 2022 21:13:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CE87C340E5; Mon, 24 Jan 2022 21:13:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058838; bh=4Xtodu3zTAwAMpuKMCIK/bIZ2u4C1XrKH2z0fYjbXBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qchwmpts16Qt1u53wOHHjfgdjcwZj1Vyi86ugZaUYws1lM2gaWW/i8K31ZUacDLij /7/gX8EKsjSRWOsu0iK/0mYD21ecErM2yfOGpXkh21vhp7YZzqgTqGq1gSZmjhNkn8 ZBso9g0lKXt1lM5LTP2qnqf9/gIKazhIG4nso/TQ= 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.16 0419/1039] mptcp: fix opt size when sending DSS + MP_FAIL Date: Mon, 24 Jan 2022 19:36:48 +0100 Message-Id: <20220124184139.391651474@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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 fe98e4f475baa..96c6efdd48bcc 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -821,10 +821,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