Skip to content

Commit

Permalink
cfq-iosched: free cic_index if cfqd allocation fails
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Namhyung Kim authored and Jens Axboe committed May 24, 2011
1 parent 20359f2 commit 1547010
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -3973,8 +3973,12 @@ static void *cfq_init_queue(struct request_queue *q)
return NULL;

cfqd = kmalloc_node(sizeof(*cfqd), GFP_KERNEL | __GFP_ZERO, q->node);
if (!cfqd)
if (!cfqd) {
spin_lock(&cic_index_lock);
ida_remove(&cic_index_ida, i);
spin_unlock(&cic_index_lock);
return NULL;
}

/*
* Don't need take queue_lock in the routine, since we are
Expand Down

0 comments on commit 1547010

Please sign in to comment.