diff options
author | Zhengchao Shao <shaozhengchao@huawei.com> | 2022-08-26 09:39:30 +0800 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2022-08-30 11:41:24 +0200 |
commit | b05972f01e7d30419987a1f221b5593668fd6448 (patch) | |
tree | 0f1154e9c417c39fe06deaaff849808686369233 /net | |
parent | cb10b0f91c5f76de981ef927e7dadec60c5a5d96 (diff) | |
download | linux-b05972f01e7d30419987a1f221b5593668fd6448.tar.gz linux-b05972f01e7d30419987a1f221b5593668fd6448.tar.bz2 linux-b05972f01e7d30419987a1f221b5593668fd6448.zip |
net: sched: tbf: don't call qdisc_put() while holding tree lock
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 <shaozhengchao@huawei.com>
Link: https://lore.kernel.org/r/20220826013930.340121-1-shaozhengchao@huawei.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sched/sch_tbf.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index 72102277449e..36079fdde2cb 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c @@ -356,6 +356,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; @@ -447,7 +448,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; @@ -467,6 +468,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); |