Received: by 10.223.185.116 with SMTP id b49csp1071238wrg; Fri, 23 Feb 2018 11:23:32 -0800 (PST) X-Google-Smtp-Source: AH8x225QZaskysrSEXlzzozl62p527cAXBHhXOKdatc+Q1yysAdHyPJN0J2ApHTGBNxUrpQ2VnOY X-Received: by 2002:a17:902:6b48:: with SMTP id g8-v6mr2639249plt.151.1519413812595; Fri, 23 Feb 2018 11:23:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519413812; cv=none; d=google.com; s=arc-20160816; b=jN78abMkgO+4fw4ZsPoPjJzqXsRBbBU9e8gmgtx+/iY5YvanstPreZdB+6PXgm2vWu 9jWeH5U2dGIo+ZGfOga3P+PbR2YM/iwmh8oNRlgeZRgx4tGeMUkzky/EkypwN0w351xh N9GIVQURygp0nPMBIME31Ococx0Yxx4vu+hyfcQGx+bQERgsgv2nkH+NTJvC2GBjKvUj ooSf5pjfD9EW+yOicHabzZoY6MkhIH4SgvOzISYdkoRvMzGakvKNwT5A338rlyqizEbc TbcY7JgIuMYXWW33GifX/dl+leNYRdIhJGmZv0uVdOKr3DTowz6hyOL5YpEVoHl8FNQc p12w== 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=OKD+af3WfCwPsCJ7M4YvKpQ7eDK60a3MKBKleWBoVkU=; b=dQ+BXQ+YGjuO5/Hq+aswr67wmicyIHv6QtyZu+jP8SRDrdL8F8eo3Wej7P91IR9w0T HU9BaeSbFwrBrhujDdcfjcqkA1MZ/JAN/xqfvvZeRrNq6NrLJAAHQgkUDHjQdXmyFhK+ zMWnkeiuhe5tGjIAu7knHjD0jr1N5klAWfIrQkYu9nPY7TC+2wnSdEIIiHCACUSeifem sK5XKejh68e9QVImSqjdM2s4dw3YcW79guUnFRzV0lN/NTLQSgrEGt4UPAGrygCp85OU HNaervDSINU789BdLAz949pgYaiYcuSMFqOkj9U+EyRuwXoDsXzOQ3eC9KkgS3icQkcI cSiA== 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 o4-v6si2164615plk.582.2018.02.23.11.23.18; Fri, 23 Feb 2018 11:23:32 -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 S964795AbeBWSxi (ORCPT + 99 others); Fri, 23 Feb 2018 13:53:38 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:47422 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964785AbeBWSxf (ORCPT ); Fri, 23 Feb 2018 13:53:35 -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 0611F1052; Fri, 23 Feb 2018 18:53:34 +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 095/159] sctp: only update outstanding_bytes for transmitted queue when doing prsctp_prune Date: Fri, 23 Feb 2018 19:26:43 +0100 Message-Id: <20180223170755.021741977@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170743.086611315@linuxfoundation.org> References: <20180223170743.086611315@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 d30fc5126efb0c33b7adf5966d3051db2c3d7721 ] Now outstanding_bytes is only increased when appending chunks into one packet and sending it at 1st time, while decreased when it is about to move into retransmit queue. It means outstanding_bytes value is already decreased for all chunks in retransmit queue. However sctp_prsctp_prune_sent is a common function to check the chunks in both transmitted and retransmit queue, it decrease outstanding_bytes when moving a chunk into abandoned queue from either of them. It could cause outstanding_bytes underflow, as it also decreases it's value for the chunks in retransmit queue. This patch fixes it by only updating outstanding_bytes for transmitted queue when pruning queues for prsctp prio policy, the same fix is also needed in sctp_check_transmitted. Fixes: 8dbdf1f5b09c ("sctp: implement prsctp PRIO policy") 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/outqueue.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/net/sctp/outqueue.c +++ b/net/sctp/outqueue.c @@ -368,7 +368,8 @@ static int sctp_prsctp_prune_sent(struct asoc->abandoned_sent[SCTP_PR_INDEX(PRIO)]++; streamout->abandoned_sent[SCTP_PR_INDEX(PRIO)]++; - if (!chk->tsn_gap_acked) { + if (queue != &asoc->outqueue.retransmit && + !chk->tsn_gap_acked) { if (chk->transport) chk->transport->flight_size -= sctp_data_size(chk); @@ -1429,7 +1430,8 @@ static void sctp_check_transmitted(struc /* If this chunk has not been acked, stop * considering it as 'outstanding'. */ - if (!tchunk->tsn_gap_acked) { + if (transmitted_queue != &q->retransmit && + !tchunk->tsn_gap_acked) { if (tchunk->transport) tchunk->transport->flight_size -= sctp_data_size(tchunk);