From: Jens Axboe <jens.axboe@oracle.com>
To: Neil Brown <neilb@suse.de>
Cc: Tejun Heo <tj@kernel.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] use after free bug in __blkdev_get
Date: Mon, 26 Oct 2009 08:26:07 +0100 [thread overview]
Message-ID: <20091026072607.GZ10727@kernel.dk> (raw)
In-Reply-To: <19173.11702.129258.49993@notabene.brown>
On Mon, Oct 26 2009, Neil Brown wrote:
>
>
> commit 0762b8bde9729f10f8e6249809660ff2ec3ad735
> (from 14 months ago) introduced a use-after-free bug which has just
> recently started manifesting in my md testing.
> I tried git bisect to find out what caused the bug to start
> manifesting, and it could have been the recent change to
> blk_unregister_queue (48c0d4d4c04) but the results were inconclusive.
>
> This patch certainly fixes my symptoms and looks correct as the two
> calls are now in the same order as elsewhere in that function.
>
> Signed-off-by: NeilBrown <neilb@suse.de>
>
> diff --git a/fs/block_dev.c b/fs/block_dev.c
> index 9cf4b92..8bed055 100644
> --- a/fs/block_dev.c
> +++ b/fs/block_dev.c
> @@ -1248,8 +1248,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
> bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9);
> }
> } else {
> - put_disk(disk);
> module_put(disk->fops->owner);
> + put_disk(disk);
> disk = NULL;
> if (bdev->bd_contains == bdev) {
> if (bdev->bd_disk->fops->open) {
Thanks Neil, good catch! Applied.
--
Jens Axboe
next prev parent reply other threads:[~2009-10-26 7:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-26 5:03 [PATCH] use after free bug in __blkdev_get Neil Brown
2009-10-26 7:26 ` Jens Axboe [this message]
2009-10-26 12:55 ` Tejun Heo
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=20091026072607.GZ10727@kernel.dk \
--to=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@suse.de \
--cc=tj@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.