Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1985965imu; Fri, 14 Dec 2018 04:06:28 -0800 (PST) X-Google-Smtp-Source: AFSGD/VJOQWtdDGRXcsPG9ygt8VV+wPAeDuu7/zH9peAZsBVyC2V8srjurw4YEIXupUWCerHaUMk X-Received: by 2002:a62:4e49:: with SMTP id c70mr2527864pfb.167.1544789188745; Fri, 14 Dec 2018 04:06:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544789188; cv=none; d=google.com; s=arc-20160816; b=B8HrPvj1URxZqP+/628yFggvN8Cu7vzyLsZwdSujXgz3LjJ673YlOUaDIHzffFlhi2 QMEM4lCEj1DSN0IFTp5+hrF7yh+21zdqKN4myEB14znROHjg70DHevXb6UZ/Vi2oKyGd Bz4z3UDwzV7o2YyRThLkw32K+4Nq7hXZwX4vaAk8qcDW71n6dW4E6izqCrOLjIJ7GPVA kz6qbvALwzt3YClwjyXv2olguj++mbIP0mYw44ubBCVJ5WXeqn84tnLYkabyYrO6pjI7 fhoNPcpcZ+qiGdznGslRUCwAE5JxXu342WJ5jJm/Q2UOUW6FNL9Yvea335qjlXV6eeFZ /zLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vLw3zCV65JiH6CNJcujrCn6l390CZ/JUxLGHHsCWT0o=; b=tO0URL77SVlYCTBNaSkprY5klEOwwQKh94p4aS2XUcr55e58tD0U/qM6MqaxhUA4zS OpabLxIbn2RYKry3Q6xQzOn3EzbTV4cZObeaIUC0IcpR2JvMGdMEXGhKsPjvzIe3/jyx DOvtkNv3vQJrssrtIo9JnW6JMQOZTQzHzWJLWRD8FtEogCMUve7UbuIYamIywCLQV3+N 8LSxrZYV6tBch+EEJEoSDwFjWP6d/l6F3IyJ8K4aBFewl2jGbGes7nz5Rautz013g8gV E0CTX/zGy95oYYTyjauwoP8VgNO/Lalv0i1FEEkm0O3V1ihY/dvbQ2zlnvlF1wgrsA+l Bcbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Og4oBMmC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1si4008461pfn.111.2018.12.14.04.06.13; Fri, 14 Dec 2018 04:06:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Og4oBMmC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730089AbeLNMCf (ORCPT + 99 others); Fri, 14 Dec 2018 07:02:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:45546 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730069AbeLNMCe (ORCPT ); Fri, 14 Dec 2018 07:02:34 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E304B21473; Fri, 14 Dec 2018 12:02:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544788953; bh=KkUP2mVR+i+xQ51wlqMV+IuY69SmkBWMeUopSSz9fmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Og4oBMmC8sP9DMqZGiTWGbLoNt2JGHEPG1CP56bSBGdlZ6eGDq3Ou5MxQn0DaVn1y vldmrAKcAGGkPQdNdwNteRqmNs0H9pDtw9QuGG+wMqDAtUYMoZD+66cImtkqVFFyCZ kv4tzYql19xSY47CQ9UD/parG0/Ss17m32DCLgHI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Audykowicz , Xin Long , Marcelo Ricardo Leitner , Neil Horman , "David S. Miller" Subject: [PATCH 4.19 019/142] sctp: update frag_point when stream_interleave is set Date: Fri, 14 Dec 2018 12:58:24 +0100 Message-Id: <20181214115747.816593005@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181214115747.053633987@linuxfoundation.org> References: <20181214115747.053633987@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xin Long [ Upstream commit 4135cce7fd0a0d755665c02728578c7c5afe4726 ] sctp_assoc_update_frag_point() should be called whenever asoc->pathmtu changes, but we missed one place in sctp_association_init(). It would cause frag_point is zero when sending data. As says in Jakub's reproducer, if sp->pathmtu is set by socketopt, the new asoc->pathmtu inherits it in sctp_association_init(). Later when transports are added and their pmtu >= asoc->pathmtu, it will never call sctp_assoc_update_frag_point() to set frag_point. This patch is to fix it by updating frag_point after asoc->pathmtu is set as sp->pathmtu in sctp_association_init(). Note that it moved them after sctp_stream_init(), as stream->si needs to be set first. Frag_point's calculation is also related with datachunk's type, so it needs to update frag_point when stream->si may be changed in sctp_process_init(). v1->v2: - call sctp_assoc_update_frag_point() separately in sctp_process_init and sctp_association_init, per Marcelo's suggestion. Fixes: 2f5e3c9df693 ("sctp: introduce sctp_assoc_update_frag_point") Reported-by: Jakub Audykowicz Signed-off-by: Xin Long Acked-by: Marcelo Ricardo Leitner Acked-by: Neil Horman Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/sctp/associola.c | 7 ++++--- net/sctp/sm_make_chunk.c | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) --- a/net/sctp/associola.c +++ b/net/sctp/associola.c @@ -118,9 +118,6 @@ static struct sctp_association *sctp_ass asoc->flowlabel = sp->flowlabel; asoc->dscp = sp->dscp; - /* Initialize default path MTU. */ - asoc->pathmtu = sp->pathmtu; - /* Set association default SACK delay */ asoc->sackdelay = msecs_to_jiffies(sp->sackdelay); asoc->sackfreq = sp->sackfreq; @@ -252,6 +249,10 @@ static struct sctp_association *sctp_ass 0, gfp)) goto fail_init; + /* Initialize default path MTU. */ + asoc->pathmtu = sp->pathmtu; + sctp_assoc_update_frag_point(asoc); + /* Assume that peer would support both address types unless we are * told otherwise. */ --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -2462,6 +2462,9 @@ int sctp_process_init(struct sctp_associ asoc->c.sinit_max_instreams, gfp)) goto clean_up; + /* Update frag_point when stream_interleave may get changed. */ + sctp_assoc_update_frag_point(asoc); + if (!asoc->temp && sctp_assoc_set_id(asoc, gfp)) goto clean_up;