diff mbox

[net] htb: call qdisc_root with rcu read lock held

Message ID 1465877787-7974-1-git-send-email-fw@strlen.de
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Florian Westphal June 14, 2016, 4:16 a.m. UTC
saw a debug splat:
net/include/net/sch_generic.h:287 suspicious rcu_dereference_check() usage!
other info that might help us debug this:
rcu_scheduler_active = 1, debug_locks = 0
 2 locks held by kworker/2:1/710:
  #0:  ("events"){.+.+.+}, at: [<ffffffff8106ca1d>]
  #1:  ((&q->work)){+.+...}, at: [<ffffffff8106ca1d>] process_one_work+0x14d/0x690
Workqueue: events htb_work_func
Call Trace:
 [<ffffffff812dc763>] dump_stack+0x85/0xc2
 [<ffffffff8109fee7>] lockdep_rcu_suspicious+0xe7/0x120
 [<ffffffff814ced47>] htb_work_func+0x67/0x70

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/sched/sch_htb.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Cong Wang June 15, 2016, 1:26 a.m. UTC | #1
On Mon, Jun 13, 2016 at 9:16 PM, Florian Westphal <fw@strlen.de> wrote:
> saw a debug splat:
> net/include/net/sch_generic.h:287 suspicious rcu_dereference_check() usage!
> other info that might help us debug this:
> rcu_scheduler_active = 1, debug_locks = 0
>  2 locks held by kworker/2:1/710:
>   #0:  ("events"){.+.+.+}, at: [<ffffffff8106ca1d>]
>   #1:  ((&q->work)){+.+...}, at: [<ffffffff8106ca1d>] process_one_work+0x14d/0x690
> Workqueue: events htb_work_func
> Call Trace:
>  [<ffffffff812dc763>] dump_stack+0x85/0xc2
>  [<ffffffff8109fee7>] lockdep_rcu_suspicious+0xe7/0x120
>  [<ffffffff814ced47>] htb_work_func+0x67/0x70
>
> Signed-off-by: Florian Westphal <fw@strlen.de>

Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
David Miller June 15, 2016, 9:43 p.m. UTC | #2
From: Florian Westphal <fw@strlen.de>
Date: Tue, 14 Jun 2016 06:16:27 +0200

> saw a debug splat:
> net/include/net/sch_generic.h:287 suspicious rcu_dereference_check() usage!
> other info that might help us debug this:
> rcu_scheduler_active = 1, debug_locks = 0
>  2 locks held by kworker/2:1/710:
>   #0:  ("events"){.+.+.+}, at: [<ffffffff8106ca1d>]
>   #1:  ((&q->work)){+.+...}, at: [<ffffffff8106ca1d>] process_one_work+0x14d/0x690
> Workqueue: events htb_work_func
> Call Trace:
>  [<ffffffff812dc763>] dump_stack+0x85/0xc2
>  [<ffffffff8109fee7>] lockdep_rcu_suspicious+0xe7/0x120
>  [<ffffffff814ced47>] htb_work_func+0x67/0x70
> 
> Signed-off-by: Florian Westphal <fw@strlen.de>

Applied.
diff mbox

Patch

diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index d4b4218..62f9d81 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1007,7 +1007,9 @@  static void htb_work_func(struct work_struct *work)
 	struct htb_sched *q = container_of(work, struct htb_sched, work);
 	struct Qdisc *sch = q->watchdog.qdisc;
 
+	rcu_read_lock();
 	__netif_schedule(qdisc_root(sch));
+	rcu_read_unlock();
 }
 
 static int htb_init(struct Qdisc *sch, struct nlattr *opt)