Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4482875rwb; Tue, 6 Sep 2022 08:08:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR5mjVLLZDn2N8E7cjftJo4FJh4O+861Pl0uehadOXU/tgvXFTTL+e6+WnKhrL4wcY/rm0yC X-Received: by 2002:a17:906:dc93:b0:742:133b:42c3 with SMTP id cs19-20020a170906dc9300b00742133b42c3mr26127905ejc.502.1662476898105; Tue, 06 Sep 2022 08:08:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662476898; cv=none; d=google.com; s=arc-20160816; b=L4lv021Qv0GrFGf2K6gRCV5TPMBfcNHBKJw+jJFjtBMqWXcQJpX+I/XpjQ4KZl/kA/ 6BW7p1HayepH/C3wmnhCIROx99DrLAggsgNPxse/pioATd+v9294EOKwo+/hFH8Vu5t9 UY0Ll4KqYaFhYXjgQIgUuwZvSauS+U4nPSZNX2eu/Su+T0NX/as66OSTwNlRw8+YtOkc cq7gdWIj71+vpmkgYjDvvTBWHKyUTEnfp5QFf4qYQxprmGutfg23q1hyJ0fOrHrR/gaM lPkNK7rPXhfqbkNlYw6j2rQR/LvIEUkqk50muA7GLBiM60zCq6urrjHRosv7WRw2JFl5 lkzQ== 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=xV5KQc9kp3cHqkSwsrEWjKM0gYxPhZRwCF8yae6zdMs=; b=AGG2USKUsPGsMxbN5HBqjxjxwxM6+33mBmJFvaBGMCD6bFyS1NaLHGZCNSvIlW7PQn JOhofrdiDjJH7ONR984mOngDQ8zD3bxeZA1roiYw/JHSBoOH3wPO0LLf2TmMIZNRSBN4 CrVBz8gr1rSAFUZqyzYtILMrvtsnl4pI8XS0tIdtg+FyIXTtkDro1izzheKdFI2cJWmf 4mv0MbYjXa2EgJ+YzIUFjizw37v6TeXvmF/EUPc8jWTUBLRcx8+P754OKZs2u6w7rEsG hiGfxbOf+BwQ/dlpdv9GyX0BQwoP+iscrPDly5yX+JPGIvwOkfiGtykyvjXOEvV+oMIW pEuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RG7tW2yy; 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 e20-20020a056402191400b00447fb143ad4si437397edz.417.2022.09.06.08.07.53; Tue, 06 Sep 2022 08:08:18 -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=RG7tW2yy; 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 S233726AbiIFNkF (ORCPT + 99 others); Tue, 6 Sep 2022 09:40:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240675AbiIFNin (ORCPT ); Tue, 6 Sep 2022 09:38:43 -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 362D076449; Tue, 6 Sep 2022 06:35:37 -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 6A7C061548; Tue, 6 Sep 2022 13:34:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73A58C433C1; Tue, 6 Sep 2022 13:34:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662471289; bh=V8KfkY9Z3LzwSc0dKcGeIHwZTwBbtxyXlAkRQ28XaYQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RG7tW2yyP+YGR/1jwFnbjxhkcYQo59Q2GjA+THy1Jgh2V8+a0b5Y6CS62ugG2+kVh cAl9JZL6ttAofEVALauWRT+/RqcUnGYs/dofGiakHH9neNhuaV3X5ZQMQfkTLD3wm3 UxyP1bRvQBIbRulvsPIY7MSqMtVYQxaCgj9dyaME= 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?= , Jakub Kicinski , Sasha Levin , zdi-disclosures@trendmicro.com Subject: [PATCH 5.10 17/80] sch_cake: Return __NET_XMIT_STOLEN when consuming enqueued skb Date: Tue, 6 Sep 2022 15:30:14 +0200 Message-Id: <20220906132817.654141837@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906132816.936069583@linuxfoundation.org> References: <20220906132816.936069583@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 90fabae8a2c225c4e4936723c38857887edde5cc ] When the GSO splitting feature of sch_cake is enabled, GSO superpackets will be broken up and the resulting segments enqueued in place of the original skb. In this case, CAKE calls consume_skb() on the original skb, but still returns NET_XMIT_SUCCESS. This can confuse parent qdiscs into assuming the original skb still exists, when it really has been freed. Fix this by adding the __NET_XMIT_STOLEN flag to the return value in this case. Fixes: 0c850344d388 ("sch_cake: Conditionally split GSO segments") Signed-off-by: Toke Høiland-Jørgensen Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-18231 Link: https://lore.kernel.org/r/20220831092103.442868-1-toke@toke.dk Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sched/sch_cake.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c index c580139fcedec..4e380534dbc92 100644 --- a/net/sched/sch_cake.c +++ b/net/sched/sch_cake.c @@ -1713,6 +1713,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, } idx--; flow = &b->flows[idx]; + ret = NET_XMIT_SUCCESS; /* ensure shaper state isn't stale */ if (!b->tin_backlog) { @@ -1771,6 +1772,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, qdisc_tree_reduce_backlog(sch, 1-numsegs, len-slen); consume_skb(skb); + ret |= __NET_XMIT_STOLEN; } else { /* not splitting */ cobalt_set_enqueue_time(skb, now); @@ -1904,7 +1906,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, } b->drop_overlimit += dropped; } - return NET_XMIT_SUCCESS; + return ret; } static struct sk_buff *cake_dequeue_one(struct Qdisc *sch) -- 2.35.1