From: Namhyung Kim Date: Tue, 24 May 2011 08:23:22 +0000 (+0200) Subject: cfq-iosched: free cic_index if cfqd allocation fails X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1547010e6e15a3f44f49381246421a1e19de526e;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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 --- diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 6dd2179cf1a4..7c52d6888924 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