Skip to contentSkip to conversation

cfq_get_queue: fix possible NULL pointer access

PATCH Applied Oleg Nesterov 2 participants 2 messages Oct 20, 2007 – Oct 21, 2007 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cfq_get_queue: fix possible NULL pointer access

cfq_get_queue()->cfq_find_alloc_queue() can fail, check the returned value.

block/cfq-iosched.c renamed from block/cfq-iosched.c~3_get +4 -1
@@ -1443,8 +1443,11 @@ cfq_get_queue(struct cfq_data *cfqd, int
 		cfqq = *async_cfqq;
 	}
 
-	if (!cfqq)
+	if (!cfqq) {
 		cfqq = cfq_find_alloc_queue(cfqd, is_sync, tsk, gfp_mask);
+		if (!cfqq)
+			return NULL;
+	}
 
 	/*
 	 * pin the queue now that it's allocated, scheduler exit will prune it
Applied
#1 lore raw
Quoted 1 line · Oleg Nesterov

cfq_get_queue()->cfq_find_alloc_queue() can fail, check the returned value.

Thanks, applied! No normal IO paths use it without __GFP_WAIT, so it's not a critical fix. But that could change in the future and then cause allocation failure, so I'll add the patch.

Signature · 1 line
Jens Axboe