From 1547010e6e15a3f44f49381246421a1e19de526e Mon Sep 17 00:00:00 2001 From: Namhyung Kim Date: Tue, 24 May 2011 10:23:22 +0200 Subject: 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 Signed-off-by: Jens Axboe --- block/cfq-iosched.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'block') diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 6dd2179cf1a..7c52d688892 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c @@ -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 -- cgit v1.2.3-70-g09d2