Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp720349pxb; Mon, 25 Oct 2021 17:24:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmTk2xZreYEM6RIV6hoaOb14ulZMyxO8/OeCK4S0206f3Pxlda2nFaxZnrgmmFsKxqEDVU X-Received: by 2002:a63:7742:: with SMTP id s63mr12407986pgc.375.1635207856645; Mon, 25 Oct 2021 17:24:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635207856; cv=none; d=google.com; s=arc-20160816; b=LguzfWSfSJfZvFvbpLOSCElV+RFIGTxl+pVI1+qvZwI//hTx8aBwOQt9d31TSri2Nr eb8THm7NHAgLhNKNR9sqmlMx0zOFwOWzhhpjz5kkTR2xRfBStrzEzapA9EA0A3j7w3a7 BkrtbU2XTHLcAtQup7WCax9MTEVYxYb7gNd31ttN7Cody7YvOuwioig9fCOtNKwyCez+ JGk/fwLcLri/MYnlJl5F2/6lgB1oC7CyQS03f89RI+gPwdk1rfh9X6vWaxvIFQ/qozOc Nf9X5LG8cG5rU+cEs7eTWDW8MUfuEJfukb2z4HHKONoHMMtsUNk8ILzP0Q4+iPG5Npcb GF6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+umk1se7vHV7wPfFb34+4eb/8hTM6GCDzBvMkgZMBDk=; b=w/NSR3oJZOgX/6wPrTnIbOVTAynb9L+g+8VhuoZq+XcwR5eSclrYZ580/C7hsb4XC/ jx8TE8Gz1a4ATZeNWIjHaiHcuw+JZvYzgztiQgGz6065pKxrqu7Ps+JNtGoMWZ9HZsH/ owSgKSFLc9CNvxdxbA8pgcfrNkBoxfZA3tp1TI8iZu8MMwPfbQmiYkfggQh7LRfb62Z6 YJKC2nhlT0N/frt0X9hjFPZEgN4iyNgjO9Dw3ye2bj+OBJ/+kAli5/w7HQoEaQWjttDn W/g8Sd3Oy5Rx+a/fN0V3yk1RxUDJD9egtRafQGiuu+APMhSuhL4JSqq03r1g34GBcFTo HeLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Iizsq3K4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a15si28870111pgw.185.2021.10.25.17.24.03; Mon, 25 Oct 2021 17:24:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Iizsq3K4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236070AbhJYTuP (ORCPT + 99 others); Mon, 25 Oct 2021 15:50:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:36294 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236658AbhJYTpA (ORCPT ); Mon, 25 Oct 2021 15:45:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 65D0960FE8; Mon, 25 Oct 2021 19:38:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635190735; bh=rOKT46R8nlrWPIv3/unPX30Wj7vV5fuFnqLtSGKAk3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Iizsq3K4hz53sUazOFg9Utx1sckYtgalQs4kIlk3uz6uzaeV5dKwEIt/riz4MLYk+ Kxx7qfUl87nvoapljfjLv06MGsxxQVXN3NIxbkixFW2AS0Mb8r9Tn5yMFCRY5m1BfH c1wbJdUZoZJOHd3eEo0s7728fMfdcrSn7hOJtCwg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Blakey , "David S. Miller" , Sasha Levin Subject: [PATCH 5.14 040/169] net/sched: act_ct: Fix byte count on fragmented packets Date: Mon, 25 Oct 2021 21:13:41 +0200 Message-Id: <20211025191022.912740631@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025191017.756020307@linuxfoundation.org> References: <20211025191017.756020307@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paul Blakey [ Upstream commit 2dc4e9e88cfcc38454d52b01ed3422238c134003 ] First fragmented packets (frag offset = 0) byte len is zeroed when stolen by ip_defrag(). And since act_ct update the stats only afterwards (at end of execute), bytes aren't correctly accounted for such packets. To fix this, move stats update to start of action execute. Fixes: b57dc7c13ea9 ("net/sched: Introduce action ct") Signed-off-by: Paul Blakey Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/sched/act_ct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c index 1b4b3514c94f..07f4dce7b535 100644 --- a/net/sched/act_ct.c +++ b/net/sched/act_ct.c @@ -960,6 +960,7 @@ static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a, tmpl = p->tmpl; tcf_lastuse_update(&c->tcf_tm); + tcf_action_update_bstats(&c->common, skb); if (clear) { qdisc_skb_cb(skb)->post_ct = false; @@ -1049,7 +1050,6 @@ out_push: qdisc_skb_cb(skb)->post_ct = true; out_clear: - tcf_action_update_bstats(&c->common, skb); if (defrag) qdisc_skb_cb(skb)->pkt_len = skb->len; return retval; -- 2.33.0