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

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

sch_fq_codel: avoid double free on init failure



It is very unlikely to happen but the backlogs memory allocation
could fail and will free q->flows, but then ->destroy() will free
q->flows too. For correctness remove the first free and let ->destroy
clean up.

Fixes: 87b60cfa ("net_sched: fix error recovery at qdisc creation")
Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3501d059
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -491,10 +491,8 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt)
		if (!q->flows)
			return -ENOMEM;
		q->backlogs = kvzalloc(q->flows_cnt * sizeof(u32), GFP_KERNEL);
		if (!q->backlogs) {
			kvfree(q->flows);
		if (!q->backlogs)
			return -ENOMEM;
		}
		for (i = 0; i < q->flows_cnt; i++) {
			struct fq_codel_flow *flow = q->flows + i;