Message ID | 20221022104054.221968-1-shaozhengchao@huawei.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] net: sched: cbq: stop timer in cbq_destroy() when cbq_init() fails | expand |
On Sat, Oct 22, 2022 at 06:40:54PM +0800, Zhengchao Shao wrote: > When qdisc_create() fails to invoke the cbq_init() function for > initialization, the timer has been started. But cbq_destroy() doesn't > stop the timer. Fix it. > Hmm? qdisc_watchdog_init() only initializes it, not starts it, right? Thanks.
On 2022/10/23 10:54, Cong Wang wrote: > On Sat, Oct 22, 2022 at 06:40:54PM +0800, Zhengchao Shao wrote: >> When qdisc_create() fails to invoke the cbq_init() function for >> initialization, the timer has been started. But cbq_destroy() doesn't >> stop the timer. Fix it. >> > > Hmm? qdisc_watchdog_init() only initializes it, not starts it, right? > > Thanks. Hi Wang: Thank you for your review. The description is incorrect, qdisc_watchdog_init() only initializes timer, and cbq_destroy() missed to cancle timer. Zhengchao Shao
From: shaozhengchao <shaozhengchao@huawei.com> Date: Mon, 24 Oct 2022 18:53:30 +0800 > On 2022/10/23 10:54, Cong Wang wrote: > > On Sat, Oct 22, 2022 at 06:40:54PM +0800, Zhengchao Shao wrote: > >> When qdisc_create() fails to invoke the cbq_init() function for > >> initialization, the timer has been started. But cbq_destroy() doesn't > >> stop the timer. Fix it. > >> > > > > Hmm? qdisc_watchdog_init() only initializes it, not starts it, right? > > > > Thanks. > Hi Wang: > Thank you for your review. The description is incorrect, > qdisc_watchdog_init() only initializes timer, and cbq_destroy() missed > to cancle timer. In the ->init() failure path, we need not cancel timer. Another path where we call ->destroy() is qdisc_destroy(), but just before calling ->destroy(), we call qdisc_reset() and cbq_reset() cancels the timer. So, I think we need not add qdisc_watchdog_cancel() in cbq_destroy().
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 6568e17c4c63..8fcdd74af4cc 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c @@ -1371,6 +1371,7 @@ static void cbq_destroy(struct Qdisc *sch) #ifdef CONFIG_NET_CLS_ACT q->rx_class = NULL; #endif + qdisc_watchdog_cancel(&q->watchdog); /* * Filters must be destroyed first because we don't destroy the * classes from root to leafs which means that filters can still
When qdisc_create() fails to invoke the cbq_init() function for initialization, the timer has been started. But cbq_destroy() doesn't stop the timer. Fix it. Fixes: 88a993540a65 ("[NET_SCHED]: sch_cbq: use hrtimer based watchdog") Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com> --- net/sched/sch_cbq.c | 1 + 1 file changed, 1 insertion(+)