Commit 1547010e6e15a3f44f49381246421a1e19de526e

Authored by Namhyung Kim
Committed by Jens Axboe
1 parent 20359f27e8

cfq-iosched: free cic_index if cfqd allocation fails

When struct cfq_data allocation fails, cic_index need to be freed.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>

Showing 1 changed file with 5 additions and 1 deletions Side-by-side Diff

... ... @@ -3973,8 +3973,12 @@
3973 3973 return NULL;
3974 3974  
3975 3975 cfqd = kmalloc_node(sizeof(*cfqd), GFP_KERNEL | __GFP_ZERO, q->node);
3976   - if (!cfqd)
  3976 + if (!cfqd) {
  3977 + spin_lock(&cic_index_lock);
  3978 + ida_remove(&cic_index_ida, i);
  3979 + spin_unlock(&cic_index_lock);
3977 3980 return NULL;
  3981 + }
3978 3982  
3979 3983 /*
3980 3984 * Don't need take queue_lock in the routine, since we are