public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cfq_get_queue: fix possible NULL pointer access
@ 2007-10-20 13:11 Oleg Nesterov
  2007-10-21 19:16 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2007-10-20 13:11 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Andrew Morton, linux-kernel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] cfq_get_queue: fix possible NULL pointer access
  2007-10-20 13:11 [PATCH] cfq_get_queue: fix possible NULL pointer access Oleg Nesterov
@ 2007-10-21 19:16 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2007-10-21 19:16 UTC (permalink / raw)
  To: Oleg Nesterov; +Cc: Andrew Morton, linux-kernel

On Sat, Oct 20 2007, Oleg Nesterov wrote:
> 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.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-10-21 19:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-20 13:11 [PATCH] cfq_get_queue: fix possible NULL pointer access Oleg Nesterov
2007-10-21 19:16 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox