Received: by 10.223.176.5 with SMTP id f5csp1026335wra; Fri, 2 Feb 2018 09:56:28 -0800 (PST) X-Google-Smtp-Source: AH8x226gwrgtcwM3/2+EUgFGxtg1iHNoaEMALe1/x6fh1Zlj+gCf7RJ1tFongDpNk0n+5t4fMTOp X-Received: by 2002:a17:902:123:: with SMTP id 32-v6mr35884228plb.278.1517594187988; Fri, 02 Feb 2018 09:56:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517594187; cv=none; d=google.com; s=arc-20160816; b=DTRRrZg4J5jt/maTSopkHTtudUNE8Dd2vNxpeP9JmWPTbYmvXr6xDaLoZL5+jSqhE2 ZWUvNUZ14rdacC6UlotgRCyLX7y+zVyaxWycBz2ysLCfX/0xzHpCpUs/e9/onzD5O6ZX 4ymMdTtQcrmJHz6/NMdxPiNOzaYUdDwiHlXJoCoeDkCBBUiDF3uRE43M61TWZn5ixZ8H jTUQht5kfjniyr0mqsY8+V73PknVVRhNfz2BdoPYgQtJ2iq6B3S25JeSUb6AmeU8nda/ 5fXN5GXjaQG2CAxB8mGEiMQzizv0HwrLFtLHUjiUYs5AwkMFPFzT48agZk3yB0eRICOS NWbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=X6J8pnjYGSWYYX6gpDJluTP5MLuwgQcD39EtAyC9rHE=; b=yYvSTmtf4fpooW24SBPzYEuy0u8DsZt3MgXw6GIzUQeg9/5rMdx1TN6K/PjN1SPfzX L4SvwGgmkgejMbid0MLfF+iRh2aTyOa+BsLwH2ylOqfM82+ad6kPw14i4jjrfMes4dc4 91WDuDWy4faNp4efiaGtlyR0a9IF0l7LS2MjjRv5WTuMKQnGPuLs+uexSmXxfFDvBD5M KDiKy4QFZsKnswMUPbSie/PD0JjXREJKcZ/gXZriAm1dfNzara7Ho5GWHmKDiVKlfkda tj6LcQ1kOOguE/ubtyNJAVrjBk0y/v3lV59Pv14UZp2r5SfNAnKcJ8lN2vkakh6l8I8w uLqQ== ARC-Authentication-Results: i=1; mx.google.com; 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 y1-v6si2125478pln.220.2018.02.02.09.56.13; Fri, 02 Feb 2018 09:56:27 -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; 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 S1753463AbeBBRzL (ORCPT + 99 others); Fri, 2 Feb 2018 12:55:11 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:38714 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753401AbeBBRLl (ORCPT ); Fri, 2 Feb 2018 12:11:41 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3F29BF17; Fri, 2 Feb 2018 17:11:40 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xin Long , Marcelo Ricardo Leitner , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 072/156] sctp: only allow the asoc reset when the asoc outq is empty Date: Fri, 2 Feb 2018 17:57:33 +0100 Message-Id: <20180202140843.543142768@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140840.242829545@linuxfoundation.org> References: <20180202140840.242829545@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- net/sctp/stream.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/net/sctp/stream.c +++ b/net/sctp/stream.c @@ -224,6 +224,9 @@ int sctp_send_reset_assoc(struct sctp_as if (asoc->strreset_outstanding) return -EINPROGRESS; + if (!sctp_outq_is_empty(&asoc->outqueue)) + return -EAGAIN; + chunk = sctp_make_strreset_tsnreq(asoc); if (!chunk) return -ENOMEM; @@ -544,6 +547,12 @@ struct sctp_chunk *sctp_process_strreset } goto err; } + + if (!sctp_outq_is_empty(&asoc->outqueue)) { + result = SCTP_STRRESET_IN_PROGRESS; + goto err; + } + asoc->strreset_inseq++; if (!(asoc->strreset_enable & SCTP_ENABLE_RESET_ASSOC_REQ))