diff options
author | Nikolay Aleksandrov <nikolay@cumulusnetworks.com> | 2017-08-30 12:49:02 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-30 15:26:11 -0700 |
commit | 30c31d746d0eb458ae327f522bc8e4c44cbea0f0 (patch) | |
tree | d8f6e8f11ab3ec40b0e0a43575429f0dc8695e3c /net/sched | |
parent | 3501d059921246ff617b43e86250a719c140bd97 (diff) | |
download | linux-30c31d746d0eb458ae327f522bc8e4c44cbea0f0.tar.bz2 |
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: 87b60cfacf9f ("net_sched: fix error recovery at qdisc creation")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r-- | net/sched/sch_fq_codel.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c index 337f2d6d81e4..2c0c05f2cc34 100644 --- a/net/sched/sch_fq_codel.c +++ b/net/sched/sch_fq_codel.c @@ -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; |