From nobody Mon Sep 8 09:04:56 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6184CC6FA89 for ; Tue, 13 Sep 2022 15:08:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235463AbiIMPIW (ORCPT ); Tue, 13 Sep 2022 11:08:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235170AbiIMPHI (ORCPT ); Tue, 13 Sep 2022 11:07:08 -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 7D4AC754BF; Tue, 13 Sep 2022 07:30:42 -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 82269614B4; Tue, 13 Sep 2022 14:29:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C972C433C1; Tue, 13 Sep 2022 14:29:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663079366; bh=W6VLe/hXXF3fX2MG1kNCDOhngH70KjD6bZGLtVEcEGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eRVAdNQuTs9BJe9+Z6z/8HE3CLA0S9I/Ni0Hw7y0L5THJ6Ywawhb7qOIvmPb8pF1B MGe1RkrzV9QFw+ZhtdwmjE0CF/l5V3huOjNPci+2NKYdQPa6U2mNTYp3XODdVYJ9m2 8uBqfY7+PaEZ2oJHIUkg441GUWTXZoB4Gxpz6i44= 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.4 106/108] sch_sfb: Also store skb len before calling child enqueue Date: Tue, 13 Sep 2022 16:07:17 +0200 Message-Id: <20220913140358.178768512@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140353.549108748@linuxfoundation.org> References: <20220913140353.549108748@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Toke H=C3=B8iland-J=C3=B8rgensen [ 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 e= nqueueing to child") Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen 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 085fe06da2a68..3aa6b4dcb1c8e 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 Qdis= c *sch, { =20 struct sfb_sched_data *q =3D qdisc_priv(sch); + unsigned int len =3D qdisc_pkt_len(skb); struct Qdisc *child =3D q->qdisc; struct tcf_proto *fl; struct sfb_skb_cb cb; @@ -403,7 +404,7 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdis= c *sch, memcpy(&cb, sfb_skb_cb(skb), sizeof(cb)); ret =3D qdisc_enqueue(skb, child, to_free); if (likely(ret =3D=3D NET_XMIT_SUCCESS)) { - qdisc_qstats_backlog_inc(sch, skb); + sch->qstats.backlog +=3D len; sch->q.qlen++; increment_qlen(&cb, q); } else if (net_xmit_drop_count(ret)) { --=20 2.35.1