LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Johannes Weiner <hannes-kernel@saeurebad.de>
To: Dale Blount <linux-kernel@dale.us>
Cc: linux-kernel@vger.kernel.org, axboe@kernel.dk
Subject: Re: PROBLEM: null pointer dereference in cfq_dispatch_requests (2.6.21-rc2 and 2.6.20)
Date: Wed, 21 Mar 2007 20:04:00 +0100	[thread overview]
Message-ID: <20070321190359.GD16768@leiferikson> (raw)
In-Reply-To: <loom.20070321T135132-397@post.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 505 bytes --]

Hi,

I think I found where the NULL may come from.  Please, anybody, do not
apply this patch before a trustful person reviewed it... Jens? ;)

My thoughts on this are, that there are two possibilities cfqq->next_rq
could be NULL: End of list or a bug when it is set (or not set).
But why does RB_EMPTY_ROOT() as last call in this loop does not trigger?

Did I even get the right place on where the NULL pointer dereference
happens? :)

=Hannes

Signed-off-by: Johannes Weiner <hannes-kernel@saeurebad.de>

[-- Attachment #2: cfq-iosched-NULL-dereference.patch --]
[-- Type: text/plain, Size: 503 bytes --]

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index b6491c0..ca84f0b 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -961,8 +961,8 @@ __cfq_dispatch_requests(struct cfq_data *cfqd, struct cfq_queue *cfqq,
 		/*
 		 * follow expired path, else get first next available
 		 */
-		if ((rq = cfq_check_fifo(cfqq)) == NULL)
-			rq = cfqq->next_rq;
+		if (!(rq = cfq_check_fifo(cfqq)) && !(rq = cfqq->next_rq))
+			break;
 
 		/*
 		 * finally, insert request into driver dispatch list

  parent reply	other threads:[~2007-03-21 19:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-28 18:02 Dan Williams
2007-02-28 18:18 ` Dan Williams
2007-02-28 18:49 ` Chuck Ebbert
2007-02-28 19:21   ` Chuck Ebbert
2007-03-01 12:08 ` Frank Seidel
2007-03-01 12:30   ` Jens Axboe
2007-03-01 19:50     ` Dan Williams
2007-03-21 13:07     ` Dale Blount
2007-03-21 18:09       ` Chuck Ebbert
2007-03-21 18:23         ` Dale Blount
2007-03-21 18:25           ` Chuck Ebbert
2007-03-21 19:59           ` Jens Axboe
2007-03-22 12:54             ` Dale Blount
2007-03-21 19:04       ` Johannes Weiner [this message]
2007-03-22 17:29         ` Johannes Weiner
2007-03-22 18:42         ` Jens Axboe
2007-03-22 19:22           ` Johannes Weiner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070321190359.GD16768@leiferikson \
    --to=hannes-kernel@saeurebad.de \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@dale.us \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: PROBLEM: null pointer dereference in cfq_dispatch_requests (2.6.21-rc2 and 2.6.20)' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).