Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6826691rwn; Tue, 13 Sep 2022 09:29:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR6uYSslzbIHfeV8RjEyLlj2uoWyjaMvunaDu/MEwsYTWDNZ3+LqZ3g7U2SXHbY8URzmQOYd X-Received: by 2002:a62:be0d:0:b0:535:df64:b106 with SMTP id l13-20020a62be0d000000b00535df64b106mr33374979pff.60.1663086567729; Tue, 13 Sep 2022 09:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663086567; cv=none; d=google.com; s=arc-20160816; b=pkepEanhlrHMhIp2uOylBYCvjc8gz0FKgIO0Vt0bOvirQgUvCPfo8pxZtqf8wkEB5X 6/AsjDm50F0XmyY4QrVEuZ+TrOhs4Uhiz+AlOu1r0GsjCp7Rj8OclCXD8xscmMhBwU1h sDehLOVXr3VuuMpY4dZVDVyWPyklDT13bEspXroJVf6opptuprhJaJniKe98ZzwQWqjf RoQ7TPV4RbA7WOogkeF8sELGP7a0r63G+kLil+nL3nwpipY2S2Wmr1sKPyUXYfJYMtPG Q/RqEtxdZoXKIVhRVmm0kqZ5mTdgshV/IhEwOafkdfPb5EBb1sPzrVyW4smsQgIce/hD w4Tw== 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=DnsQLBde2Ji3GzCOHSdB8Qj8gD8sVSKX2tA6j86eZA4=; b=rp3XCHlA6mtKtNk2Jnz+jNqfz3HWhhBQs3+b+z0evrANa0bqmpzqOlIblQQhLRhtbQ Vn9JR8zhF0DQlpjOffm6o9PxJ1Q/v+PB15VCmUR1ZygMuBWe79UhlXfXRqRA+bB7+fF1 /IqZzovJFDAqnSnJHYKHkg0pZTqp8kXJrloAxEvuy8iynocXFGsdbmvAYxWQAx0AwuMg TMIYsvhrYS0YJk/Ab8/ijrMQPviEBsYVgrfGxrvPCwy/5iSSX/WlEbAjFPdzUC3Flw8J 0NT/zET+cSYC+CVpEV/J1XEb8/eYmy6QQS+V6aPog7QFcDKKJzbLVFZo87S4zPSCmRcP RhZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D+VhbXH7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b10-20020a056a000a8a00b0054096da12b1si12813452pfl.39.2022.09.13.09.29.16; Tue, 13 Sep 2022 09:29:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D+VhbXH7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234498AbiIMOzc (ORCPT + 99 others); Tue, 13 Sep 2022 10:55:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234631AbiIMOvS (ORCPT ); Tue, 13 Sep 2022 10:51:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B3C2726A5; Tue, 13 Sep 2022 07:26:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 77293614D9; Tue, 13 Sep 2022 14:24:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F25BC433C1; Tue, 13 Sep 2022 14:24:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663079060; bh=3Mr7JGdFdjtbL+VTIFN142PxDN9qHLoULZFARFGLk5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D+VhbXH7079YFSgobn+oUXImiptu66aTK9Dgk+4eqYdSzdMlXI4x2Tk8xhs5wZ/Jw 9drbn0mUA2QnuarWR6YygvhS3wrNik8To3/6brUY/ZS1IfVqcfB/7jYD6shoBiGh+7 5e/YzSit9sL5sU4pU2nZTcgKNIGFyI7VJcRdHER4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Cong Wang , Paolo Abeni , Sasha Levin Subject: [PATCH 5.10 68/79] sch_sfb: Also store skb len before calling child enqueue Date: Tue, 13 Sep 2022 16:05:13 +0200 Message-Id: <20220913140353.463103044@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140350.291927556@linuxfoundation.org> References: <20220913140350.291927556@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Toke Høiland-Jørgensen [ Upstream commit 2f09707d0c972120bf794cfe0f0c67e2c2ddb252 ] Cong Wang noticed that the previous fix for sch_sfb accessing the queued skb after enqueueing it to a child qdisc was incomplete: the SFB enqueue function was also calling qdisc_qstats_backlog_inc() after enqueue, which reads the pkt len from the skb cb field. Fix this by also storing the skb len, and using the stored value to increment the backlog after enqueueing. Fixes: 9efd23297cca ("sch_sfb: Don't assume the skb is still around after enqueueing to child") Signed-off-by: Toke Høiland-Jørgensen Acked-by: Cong Wang Link: https://lore.kernel.org/r/20220905192137.965549-1-toke@toke.dk Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/sched/sch_sfb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c index f180cf95cfc97..b2724057629f6 100644 --- a/net/sched/sch_sfb.c +++ b/net/sched/sch_sfb.c @@ -281,6 +281,7 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch, { struct sfb_sched_data *q = qdisc_priv(sch); + unsigned int len = qdisc_pkt_len(skb); struct Qdisc *child = q->qdisc; struct tcf_proto *fl; struct sfb_skb_cb cb; @@ -403,7 +404,7 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch, memcpy(&cb, sfb_skb_cb(skb), sizeof(cb)); ret = qdisc_enqueue(skb, child, to_free); if (likely(ret == NET_XMIT_SUCCESS)) { - qdisc_qstats_backlog_inc(sch, skb); + sch->qstats.backlog += len; sch->q.qlen++; increment_qlen(&cb, q); } else if (net_xmit_drop_count(ret)) { -- 2.35.1