From: Jens Axboe <axboe@kernel.dk>
To: Kevin Vigor <kevin@vigor.nu>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
linux-kernel@vger.kernel.org
Subject: Re: PATCH: dangling pointer when switching to noop elevator in obscure block drivers.
Date: Mon, 23 Aug 2010 12:11:30 +0200 [thread overview]
Message-ID: <4C724952.3050002@kernel.dk> (raw)
In-Reply-To: <20100820212510.GB29022@jimi.int.fusionio.com>
On 2010-08-20 23:25, Kevin Vigor wrote:
> Linux 2.6.35 introduced a test in the beginning of elevator_init(), like
> so:
>
> if (unlikely(q->elevator))
> return 0;
>
> So the following code sequence, which appears in two (obscure) block
> drivers is now a serious error:
>
> elevator_exit(q);
> elevator_init(q, "noop");
>
> The intent is to cleanup the default system elevator and replace it with
> the noop elevator. Instead, elevator_exit() frees the existing elevator
> object, but leaves q->elevator pointing to it; elevator_init() then
> silently fails since q->elevator is non-NULL, and the queue is left with
> the elevator pointer invalid, This leads to untold woe and segfaults
> later.
>
> The fix is trivial: zero the q->elevator pointer before calling
> elevator_init(). Note that drivers/s390/block/dasd.c already follows
> this pattern.
>
> I do not have the hardware to actually test either of the two afflicted
> drivers, but I believe the fix to be sufficiently obvious. The following
> patches are against the current version of Linus' tree.
Thanks, this was also posted last week. I think the best course of
action is to provide an API for switching the scheduler, instead of
having drivers rely on doing it manually.
--
Jens Axboe
prev parent reply other threads:[~2010-08-23 10:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-20 21:25 PATCH: dangling pointer when switching to noop elevator in obscure block drivers Kevin Vigor
2010-08-23 10:11 ` Jens Axboe [this message]
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=4C724952.3050002@kernel.dk \
--to=axboe@kernel.dk \
--cc=heiko.carstens@de.ibm.com \
--cc=kevin@vigor.nu \
--cc=linux-kernel@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox