[PATCH] cfq_get_queue: fix possible NULL pointer access

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Jens Axboe <axboe@...>
Cc: Andrew Morton <akpm@...>, <linux-kernel@...>
Date: Saturday, October 20, 2007 - 9:11 am

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

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- K/block/cfq-iosched.c~3_get	2007-10-20 15:48:35.000000000 +0400
+++ K/block/cfq-iosched.c	2007-10-20 17:05:30.000000000 +0400
@@ -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

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] cfq_get_queue: fix possible NULL pointer access, Oleg Nesterov, (Sat Oct 20, 9:11 am)