Received: by 10.223.185.116 with SMTP id b49csp1036569wrg; Fri, 23 Feb 2018 10:45:39 -0800 (PST) X-Google-Smtp-Source: AH8x227+dfAcctawVc2UyzVMwb+jHEu3SUp+EwILz3gI3UqvS63ONHeYx+MVXdZselpGhdAE1JSd X-Received: by 10.101.89.6 with SMTP id f6mr2174456pgu.22.1519411538989; Fri, 23 Feb 2018 10:45:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519411538; cv=none; d=google.com; s=arc-20160816; b=NRyX7oZUF0h9vuhu4NNAqt3cprDR8dzN0DBviqy7Ttw4FOgsDQhCSFTN+/RYQlCRRT LkCaMO2i2ENQ5x677nlYlRXLlNA4gboSpaPpc1Cih8K+bAAUJ+dYFCvBu0OrDGf/Lr76 ZTEzq8X+56WmBMf+yMnU9XjmEnqARIQryRpKdfa6ZZKlCmXZM7f72RnmduBYSFrZPSBz IW/dgvhkvWTyMU4lmyIcTXCOkc9cyv8RqYTlOFW5Grv2vUZNnPikIQ1rkbo3kbeCcmct 4BcoEeAwVlnw5ogQKZ7X+Pa8njwsz7yLxSJiK7k2LCTnCXBKvXh0gVLYpIRkZ5Kd6M1I TAXg== 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=yG5N/SRn6lzOSvzUfHyE5Y9z8SEHSXrt3ivbMcsrkAU=; b=UVpQILjzANsp6FxPnP06g7j18wJx6eiaN/ySLtWZSF+2urSEc+2bT34BZHBPYO5fsY xJnrZFjpsaWpCmfMih7Dd5lXUAXnuAFTJMmM6wUhVSlzIkyxPTbBCoas1+NpGEkvXrHz UKDdVfWatLcPhcPK+xSNSTJJ5201vbVwgEKFzMftE/4twV8BsLMi/SesxqEB5WLv5im/ 6fb5S+HKE9shp8Sg0XEysWZQOgOXKIOANUeNG0GSyZymflXyqtqZMgRn3ePVpr8nIBj+ DuIFX1Ad+51Nkz32YnbcEW+0DGkbbqHoH1xHuH0Y47ZoCRGo0lW+8iTiANgZI8cqBVdu /9kg== 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 q13si1841156pgs.277.2018.02.23.10.45.24; Fri, 23 Feb 2018 10:45:38 -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 S933654AbeBWSoo (ORCPT + 99 others); Fri, 23 Feb 2018 13:44:44 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:42594 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933618AbeBWSoi (ORCPT ); Fri, 23 Feb 2018 13:44:38 -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 4E1CF121A; Fri, 23 Feb 2018 18:44:37 +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.9 057/145] sctp: only update outstanding_bytes for transmitted queue when doing prsctp_prune Date: Fri, 23 Feb 2018 19:26:03 +0100 Message-Id: <20180223170732.209660380@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170724.669759283@linuxfoundation.org> References: <20180223170724.669759283@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.9-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 @@ -364,7 +364,8 @@ static int sctp_prsctp_prune_sent(struct asoc->sent_cnt_removable--; asoc->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); @@ -1409,7 +1410,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);