Skip to content

Commit

Permalink
cfq-iosched: free cic_index if blkio_alloc_blkg_stats fails
Browse files Browse the repository at this point in the history
If we fail allocating the blkpg stats, we free cfqd and cfgq.
But we need to free the IDA cfqd->cic_index as well.

Signed-off-by: majianpeng <majianpeng@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
majianpeng authored and Jens Axboe committed Nov 30, 2011
1 parent 59bd71a commit 2984ff3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -4036,6 +4036,11 @@ static void *cfq_init_queue(struct request_queue *q)

if (blkio_alloc_blkg_stats(&cfqg->blkg)) {
kfree(cfqg);

spin_lock(&cic_index_lock);
ida_remove(&cic_index_ida, cfqd->cic_index);
spin_unlock(&cic_index_lock);

kfree(cfqd);
return NULL;
}
Expand Down

0 comments on commit 2984ff3

Please sign in to comment.