Skip to content

Commit

Permalink
sch_sfq: fix null pointer dereference on init failure
Browse files Browse the repository at this point in the history
Currently only a memory allocation failure can lead to this, so let's
initialize the timer first.

Fixes: 6529eab ("net: sched: introduce tcf block infractructure")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Nikolay Aleksandrov authored and davem330 committed Aug 30, 2017
1 parent 634576a commit e232657
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/sched/sch_sfq.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,13 +716,13 @@ static int sfq_init(struct Qdisc *sch, struct nlattr *opt)
int i;
int err;

setup_deferrable_timer(&q->perturb_timer, sfq_perturbation,
(unsigned long)sch);

err = tcf_block_get(&q->block, &q->filter_list);
if (err)
return err;

setup_deferrable_timer(&q->perturb_timer, sfq_perturbation,
(unsigned long)sch);

for (i = 0; i < SFQ_MAX_DEPTH + 1; i++) {
q->dep[i].next = i + SFQ_MAX_FLOWS;
q->dep[i].prev = i + SFQ_MAX_FLOWS;
Expand Down

0 comments on commit e232657

Please sign in to comment.