LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Dale Blount <linux-kernel@dale.us>, linux-kernel@vger.kernel.org
Subject: Re: PROBLEM: null pointer dereference in cfq_dispatch_requests (2.6.21-rc2 and 2.6.20)
Date: Thu, 22 Mar 2007 19:42:35 +0100	[thread overview]
Message-ID: <20070322184235.GZ19922@kernel.dk> (raw)
In-Reply-To: <20070321190359.GD16768@leiferikson>

On Wed, Mar 21 2007, Johannes Weiner wrote:
> 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>

> 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;

That still only hides a bug. It is illegal for ->next_rq to be NULL
while the RB tree is non-empty.


-- 
Jens Axboe


  parent reply	other threads:[~2007-03-22 18:46 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
2007-03-22 17:29         ` Johannes Weiner
2007-03-22 18:42         ` Jens Axboe [this message]
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=20070322184235.GZ19922@kernel.dk \
    --to=jens.axboe@oracle.com \
    --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).