From: Bart Van Assche <bvanassche@acm.org>
To: Yufen Yu <yuyufen@huawei.com>, axboe@kernel.dk, jack@suse.cz
Cc: viro@zeniv.linux.org.uk, bart.vanassche@wdc.com,
linux-block@vger.kernel.org
Subject: Re: [PATCH v3] block: fix use-after-free on gendisk
Date: Mon, 15 Apr 2019 08:56:35 -0700 [thread overview]
Message-ID: <1555343795.161891.103.camel@acm.org> (raw)
In-Reply-To: <20190402120634.51040-1-yuyufen@huawei.com>
On Tue, 2019-04-02 at 20:06 +0800, Yufen Yu wrote:
> diff --git a/block/genhd.c b/block/genhd.c
> index 961b2bc4634f..a4ef0068dbb2 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -529,6 +529,18 @@ void blk_free_devt(dev_t devt)
> }
> }
>
> +/**
> + * We invalidate devt by assigning NULL pointer for devt in idr.
> + */
> +void blk_invalidate_devt(dev_t devt)
> +{
> + if (MAJOR(devt) == BLOCK_EXT_MAJOR) {
> + spin_lock_bh(&ext_devt_lock);
> + idr_replace(&ext_devt_idr, NULL, blk_mangle_minor(MINOR(devt)));
> + spin_unlock_bh(&ext_devt_lock);
> + }
> +}
Did you perhaps copy the above code from blk_free_devt()? If so, please modify
blk_free_devt() such that it calls blk_invalidate_devt() instead of introducing a
copy of most of blk_free_devt().
Thanks,
Bart.
next prev parent reply other threads:[~2019-04-15 15:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-02 12:06 [PATCH v3] block: fix use-after-free on gendisk Yufen Yu
2019-04-02 15:16 ` Jan Kara
2019-04-09 14:07 ` yuyufen
2019-04-15 14:32 ` yuyufen
2019-04-15 15:04 ` Keith Busch
2019-04-15 15:56 ` Bart Van Assche [this message]
2019-04-15 16:01 ` Jan Kara
2019-04-15 19:30 ` Bart Van Assche
2019-04-15 21:36 ` Jens Axboe
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=1555343795.161891.103.camel@acm.org \
--to=bvanassche@acm.org \
--cc=axboe@kernel.dk \
--cc=bart.vanassche@wdc.com \
--cc=jack@suse.cz \
--cc=linux-block@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=yuyufen@huawei.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