Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4472841rwb; Tue, 6 Sep 2022 08:02:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR5R++seFqnIxxuDQIjrolBN2rNiLHl2evO+bWwhao9OWE0jy3gmaB9vlq8TwJz4VgBktz4w X-Received: by 2002:a17:90a:5a0b:b0:200:6358:83e4 with SMTP id b11-20020a17090a5a0b00b00200635883e4mr11443011pjd.151.1662476554692; Tue, 06 Sep 2022 08:02:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662476554; cv=none; d=google.com; s=arc-20160816; b=SpeI43c2XPsgSvSjpCWtCh4RSrqZ3vZ0sYp3svm1EzG+2N3WZ1s7Iyfy8OiodJB+/E i2tYEP7c+vOY0BdxiiijiWq59Hk33uXLMqfaIVvMKYJ331XpLu9VZJSyHo/faKZa91Wo Tz+L/dwqH6gpFbtBOzFvpFZslRqvkvje6QMh8Jo4qKvMZ4P5IuFaR55uGp96wq75cTqk L5NyvasV7epOv3XPHLSwArbMGsmknf7zMi15WUUW6ID0X9StHffwyJHfXbqBBVlVyoWI t2e2Cpghu/Q2Uqz9jLIkCND8eq0Ket84vJ/BQo8KFuXlJL7E/mAL3do1ne+44xZKQHe8 ouYA== 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=C8kdlWRwDCr46shryzJlnEcHBzU+62wjEGAz2tsibsA=; b=JOw3iWRAK5+ipRGLzTbNjCzjmmIovyUWMfod3N1EHDSUht2TnNCVw7fPE5gyAlDLXd XEVb+cU8EWYnAPLsr7rVJrjJ3EuNtXyqkf0F7c55jItdzdni7lNmgmQOc5Pfet43QX1f JpAwxHm0Nq8vN9tAbUY3aMtl7IBMhXFwPuIGji4gE4MAdpaiA3sdNYZxz1l+fp2BJmfe 7rRXS2Y3PFJMvd6MuWx2kMLsWjczsbuKzEfS57MTd6iUx/AGkI2GfpdAN1jrM6W4x6Yz tNEL2HlnhjgIlrcfpoxqCp7kHga0ILAvieHrvPUawp/SwvligkfP/BF4E1dLYXSxp+gf Dzxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q5kNkIk+; 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 q13-20020a635c0d000000b0042c87a0ea5bsi13875142pgb.175.2022.09.06.08.02.23; Tue, 06 Sep 2022 08:02:34 -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=q5kNkIk+; 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 S240452AbiIFNc3 (ORCPT + 99 others); Tue, 6 Sep 2022 09:32:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239958AbiIFNcT (ORCPT ); Tue, 6 Sep 2022 09:32:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DE6E760CE; Tue, 6 Sep 2022 06:32:19 -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 ams.source.kernel.org (Postfix) with ESMTPS id D0A7DB818C4; Tue, 6 Sep 2022 13:32:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22F85C433C1; Tue, 6 Sep 2022 13:32:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662471136; bh=wqumMZXi1LsOqk20M9uLwZVwJ/RaUHqGDItllRlXl3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q5kNkIk+8j29lQ6H5PmpnIkOBcVfSUg5X1Up1DrlUgm48Qs2uiya9ftsqs13zI/XG q8RXZQzbi6IEjNSMyjUezag4v5N9fq0biD0yz945QDcO3LRfwuw3uWMCRC9sqa6IOf 0y2cAsgozTJQOkx+B9EhkrfYqtFUwk8MLhmls2Yk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhengchao Shao , Paolo Abeni , Sasha Levin Subject: [PATCH 5.10 13/80] net: sched: tbf: dont call qdisc_put() while holding tree lock Date: Tue, 6 Sep 2022 15:30:10 +0200 Message-Id: <20220906132817.487086640@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: Zhengchao Shao [ Upstream commit b05972f01e7d30419987a1f221b5593668fd6448 ] The issue is the same to commit c2999f7fb05b ("net: sched: multiq: don't call qdisc_put() while holding tree lock"). Qdiscs call qdisc_put() while holding sch tree spinlock, which results sleeping-while-atomic BUG. Fixes: c266f64dbfa2 ("net: sched: protect block state with mutex") Signed-off-by: Zhengchao Shao Link: https://lore.kernel.org/r/20220826013930.340121-1-shaozhengchao@huawei.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/sched/sch_tbf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index 78e79029dc631..6eb17004a9e44 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c @@ -342,6 +342,7 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt, struct nlattr *tb[TCA_TBF_MAX + 1]; struct tc_tbf_qopt *qopt; struct Qdisc *child = NULL; + struct Qdisc *old = NULL; struct psched_ratecfg rate; struct psched_ratecfg peak; u64 max_size; @@ -433,7 +434,7 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt, sch_tree_lock(sch); if (child) { qdisc_tree_flush_backlog(q->qdisc); - qdisc_put(q->qdisc); + old = q->qdisc; q->qdisc = child; } q->limit = qopt->limit; @@ -453,6 +454,7 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt, memcpy(&q->peak, &peak, sizeof(struct psched_ratecfg)); sch_tree_unlock(sch); + qdisc_put(old); err = 0; tbf_offload_change(sch); -- 2.35.1