Received: by 10.223.176.46 with SMTP id f43csp280897wra; Tue, 23 Jan 2018 20:58:53 -0800 (PST) X-Google-Smtp-Source: AH8x225enDeXZWXm5KplmR1eSISsjHq//bOc+SgLOdg4GvVVpevrgDJ+/BWEIJVk+j6aUiSbKJdQ X-Received: by 2002:a17:902:57ce:: with SMTP id g14-v6mr6973800plj.348.1516769933756; Tue, 23 Jan 2018 20:58:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516769933; cv=none; d=google.com; s=arc-20160816; b=NdrpxY9+r2BmtrVjNRySwVtIBf5K+HsoYdbKHXINhxnSNnO62Zei3wW26UAa1gfyWC /kjEQBmgo9Jyl6a9zYRoQClD61soCrMtXrkc3OMLsVCU3cQImrRMlU8iuNDmCKLUHG4G R+wg+q3GIjKx9jcJobcnCe4wjdi6n6JvWSs7L7/nEdkbV3tBOpeUphZh1UUPoRSDkepa we/nQ0vHpH+6FSWDITKWuAS5/NCiwss+MPMCpeIt00mHOng+G29VDOLDj7CscrN5B6Cg w3wFqChN6p1YukWODIdMXKPskKf13DEssMSw7VaJCXiflc3Ok1EkRdXebZuE4oToFsDK lT8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=m5ndrNPIsYcGmDHKEoVd5/kbVmEnRqsJWwwC0xd/sos=; b=KNxJJcp2E7LTAaB/53O7Lx4OJ7WW+NYR47NblwdfEk8UDe4BC2o7LDamH/wHugm5He GeJXCrr2JhOlTn1pYlmBqhp6PtIBlH8wGd9DWKqJDHC5lKlZgiIfyelXdDd/hphqo2C8 FZozlgTzlT1I9gBwHoFGfTneAXx+kgyABPketA8o9LAE4KlSk1O8NwoDDD4fPk8juPj8 iXos/IgAvQrRpCZcj/7zgtZwulphl6qE4gCV/0qWv6tslu9Shju84VH9IWc8lK40pCHP bRbQtsmL3IhgZiJi+jg/orXStNIiv9h0/W08bM3leSK0B/yy0TTH9xr+VDGSB1LEOh4k k6DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=POi/MAkD; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 70-v6si5557185ple.246.2018.01.23.20.58.40; Tue, 23 Jan 2018 20:58:53 -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=@microsoft.com header.s=selector1 header.b=POi/MAkD; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932497AbeAXE6H (ORCPT + 99 others); Tue, 23 Jan 2018 23:58:07 -0500 Received: from mail-cys01nam02on0117.outbound.protection.outlook.com ([104.47.37.117]:59166 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752835AbeAXEPR (ORCPT ); Tue, 23 Jan 2018 23:15:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=m5ndrNPIsYcGmDHKEoVd5/kbVmEnRqsJWwwC0xd/sos=; b=POi/MAkDvhYOW8ot22nmgs4/vE0x2Je43XyW3/qsCan0NCyq1HJnqdwgwFBH2qkFSp55OS0Fkjcj1rh2a3S947YNoqdzGWu7OmWBsGlYsZXj9HYXnxUxv4NEkP+9WdGV2zEwKeGab2rDHvYi7ZSuvKqqgq33sYPZEuOtrey5Ytc= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1080.namprd21.prod.outlook.com (52.132.130.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.464.1; Wed, 24 Jan 2018 04:15:14 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::6485:b98:d15e:9da7]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::6485:b98:d15e:9da7%2]) with mapi id 15.20.0464.000; Wed, 24 Jan 2018 04:15:14 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Xin Long , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 043/100] sctp: only allow the asoc reset when the asoc outq is empty Thread-Topic: [PATCH AUTOSEL for 4.14 043/100] sctp: only allow the asoc reset when the asoc outq is empty Thread-Index: AQHTlMndakuTu3Q8j0OTnLgHYdHXhg== Date: Wed, 24 Jan 2018 04:14:45 +0000 Message-ID: <20180124041414.32065-43-alexander.levin@microsoft.com> References: <20180124041414.32065-1-alexander.levin@microsoft.com> In-Reply-To: <20180124041414.32065-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1080;7:FdjO96fCsDxl5fxlicR/+n7l25nfg8Sbm5asPd2JN21GkA9b/8gcZQSJsUI0g4dsRiLCaGTmIM68MZwQ5zF2rhlCM/c8ovbIT6HaSixYZiiEh8Tb++yoqhqr/SMY2D1R+sMUiV5ujSd3PbIIDMECIRyMMp/mlYWLPg76WXkixO/tcVFm6H+SqUhiurB3xxhjLk3+bpCCs31Nae8tIyw2p5/9HXLKAo0MM7heLLt6Fm+sqbpK1D7UTGpsB4aRCNw2 x-ms-office365-filtering-correlation-id: 802af1df-73a0-4470-02e1-08d562e1119c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603307)(7193020);SRVR:DM5PR2101MB1080; x-ms-traffictypediagnostic: DM5PR2101MB1080: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(85827821059158); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040501)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231046)(2400081)(944501161)(93006095)(93001095)(6055026)(61426038)(61427038)(6041288)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1080;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1080; x-forefront-prvs: 056297E276 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(396003)(346002)(39860400002)(39380400002)(366004)(189003)(199004)(72206003)(110136005)(316002)(5250100002)(6346003)(2900100001)(54906003)(1076002)(6116002)(3846002)(22452003)(36756003)(53936002)(99286004)(6512007)(68736007)(2501003)(3660700001)(14454004)(3280700002)(86362001)(102836004)(7736002)(5660300001)(305945005)(575784001)(107886003)(6486002)(6506007)(2906002)(81156014)(26005)(25786009)(4326008)(81166006)(39060400002)(105586002)(8936002)(59450400001)(106356001)(478600001)(10290500003)(6436002)(8676002)(2950100002)(86612001)(97736004)(76176011)(6666003)(10090500001)(66066001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1080;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: y0cbGlGg/aPWZAkuJtrZ8Mjg6/sgsaW9EbkVygsICMFeS5VGC2mnyw4EcWhPc5/dtRPdtRYX3Q8KoUlyOhCyOQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 802af1df-73a0-4470-02e1-08d562e1119c X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2018 04:14:45.5908 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1080 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xin Long [ Upstream commit 5c6144a0eb5366ae07fc5059301b139338f39bbd ] As it says in rfc6525#section5.1.4, before sending the request, C2: The sender has either no outstanding TSNs or considers all outstanding TSNs abandoned. Prior to this patch, it tried to consider all outstanding TSNs abandoned by dropping all chunks in all outqs with sctp_outq_free (even including sacked, retransmit and transmitted queues) when doing this reset, which is too aggressive. To make it work gently, this patch will only allow the asoc reset when the sender has no outstanding TSNs by checking if unsent, transmitted and retransmit are all empty with sctp_outq_is_empty before sending and processing the request. Fixes: 692787cef651 ("sctp: implement receiver-side procedures for the SSN/= TSN Reset Request Parameter") Signed-off-by: Xin Long Acked-by: Marcelo Ricardo Leitner Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/sctp/stream.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/net/sctp/stream.c b/net/sctp/stream.c index 724adf2786a2..7710133238ea 100644 --- a/net/sctp/stream.c +++ b/net/sctp/stream.c @@ -224,6 +224,9 @@ int sctp_send_reset_assoc(struct sctp_association *asoc= ) if (asoc->strreset_outstanding) return -EINPROGRESS; =20 + if (!sctp_outq_is_empty(&asoc->outqueue)) + return -EAGAIN; + chunk =3D sctp_make_strreset_tsnreq(asoc); if (!chunk) return -ENOMEM; @@ -544,6 +547,12 @@ struct sctp_chunk *sctp_process_strreset_tsnreq( } goto err; } + + if (!sctp_outq_is_empty(&asoc->outqueue)) { + result =3D SCTP_STRRESET_IN_PROGRESS; + goto err; + } + asoc->strreset_inseq++; =20 if (!(asoc->strreset_enable & SCTP_ENABLE_RESET_ASSOC_REQ)) --=20 2.11.0