Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e2326576 authored by Nikolay Aleksandrov's avatar Nikolay Aleksandrov Committed by David S. Miller
Browse files

sch_sfq: fix null pointer dereference on init failure



Currently only a memory allocation failure can lead to this, so let's
initialize the timer first.

Fixes: 6529eaba ("net: sched: introduce tcf block infractructure")
Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 634576a1
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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;