cfq-iosched: free cic_index if blkio_alloc_blkg_stats fails
[pandora-kernel.git] / block / cfq-iosched.c
index 16ace89..3beed83 100644 (file)
@@ -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;
        }