OSDN Git Service

sch_sfq: fix null pointer dereference at timer expiration
authorPaolo Abeni <pabeni@redhat.com>
Tue, 28 Nov 2017 13:28:39 +0000 (14:28 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 28 Nov 2017 20:54:05 +0000 (15:54 -0500)
While converting sch_sfq to use timer_setup(), the commit cdeabbb88134
("net: sched: Convert timers to use timer_setup()") forgot to
initialize the 'sch' field. As a result, the timer callback tries to
dereference a NULL pointer, and the kernel does oops.

Fix it initializing such field at qdisc creation time.

Fixes: cdeabbb88134 ("net: sched: Convert timers to use timer_setup()")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_sfq.c

index 890f4a4..09c1203 100644 (file)
@@ -724,6 +724,7 @@ static int sfq_init(struct Qdisc *sch, struct nlattr *opt)
        int i;
        int err;
 
+       q->sch = sch;
        timer_setup(&q->perturb_timer, sfq_perturbation, TIMER_DEFERRABLE);
 
        err = tcf_block_get(&q->block, &q->filter_list, sch);