From nobody Sat Feb 7 11:52:20 2026 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 4EC81C6FA82 for ; Tue, 13 Sep 2022 14:53:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234621AbiIMOx2 (ORCPT ); Tue, 13 Sep 2022 10:53:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234673AbiIMOtZ (ORCPT ); Tue, 13 Sep 2022 10:49:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15A9654649; Tue, 13 Sep 2022 07:25:45 -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 EB491B80EFA; Tue, 13 Sep 2022 14:25:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B38AC433D7; Tue, 13 Sep 2022 14:25:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663079126; bh=lJKcj6zKSN+LYN2ybMKT01BvRBg/7hFW8lemXwyQVIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pTu8au0j3tIB5qWkiwHpo3vpZpoUNz3MI2oB2kZ+XbmFCCBYVm2U+XIr6EVOZ9bY+ TwFpoFIHveLTMEiaJRFH8tI80WYHwGmxpxHgfhBQGeFofPc2NoTI3sssRJDPQ1VL0t i/Cffe55mhxv1Xk0jVugWyMD+ya/lfDlNR71Z/nA= 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.4 014/108] net: sched: tbf: dont call qdisc_put() while holding tree lock Date: Tue, 13 Sep 2022 16:05:45 +0200 Message-Id: <20220913140354.175582371@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-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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@huawe= i.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 5f72f3f916a5a..a7f60bb2dd513 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c @@ -297,6 +297,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 =3D NULL; + struct Qdisc *old =3D NULL; struct psched_ratecfg rate; struct psched_ratecfg peak; u64 max_size; @@ -388,7 +389,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 =3D q->qdisc; q->qdisc =3D child; } q->limit =3D qopt->limit; @@ -408,6 +409,7 @@ static int tbf_change(struct Qdisc *sch, struct nlattr = *opt, memcpy(&q->peak, &peak, sizeof(struct psched_ratecfg)); =20 sch_tree_unlock(sch); + qdisc_put(old); err =3D 0; done: return err; --=20 2.35.1