From: majianpeng Date: Wed, 30 Nov 2011 14:47:48 +0000 (+0100) Subject: cfq-iosched: free cic_index if blkio_alloc_blkg_stats fails X-Git-Tag: firefly_0821_release~3680^2~3878^2~7 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2984ff38ccf6cbc02a7a996a36c7d6f69f3c6146;p=firefly-linux-kernel-4.4.55.git cfq-iosched: free cic_index if blkio_alloc_blkg_stats fails 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 Cc: stable@kernel.org Signed-off-by: Jens Axboe --- diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 16ace89613bc..3beed83437a3 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c @@ -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; }