From: Jens Axboe <axboe@kernel.dk>
To: Lv Yunlong <lyl2019@mail.ustc.edu.cn>,
damien.lemoal@wdc.com, johannes.thumshirn@edc.com,
martin.petersen@oracle.com
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/block/null_blk/main: Fix a double free in null_init.
Date: Mon, 26 Apr 2021 09:05:04 -0600 [thread overview]
Message-ID: <434036d5-4610-3b60-74ba-5641cc2b9d5b@kernel.dk> (raw)
In-Reply-To: <20210426143229.7374-1-lyl2019@mail.ustc.edu.cn>
On 4/26/21 8:32 AM, Lv Yunlong wrote:
> In null_init, null_add_dev(dev) is called.
> In null_add_dev, it calls null_free_zoned_dev(dev) to free dev->zones
> via kvfree(dev->zones) in out_cleanup_zone branch and returns err.
> Then null_init accept the err code and then calls null_free_dev(dev).
>
> But in null_free_dev(dev), dev->zones is freed again by
> null_free_zoned_dev().
>
> My patch set dev->zones to NULL in null_free_zoned_dev() after
> kvfree(dev->zones) is called, to avoid the double free.
Applied, thanks.
--
Jens Axboe
prev parent reply other threads:[~2021-04-26 15:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-26 14:32 [PATCH] drivers/block/null_blk/main: Fix a double free in null_init Lv Yunlong
2021-04-26 15:05 ` 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=434036d5-4610-3b60-74ba-5641cc2b9d5b@kernel.dk \
--to=axboe@kernel.dk \
--cc=damien.lemoal@wdc.com \
--cc=johannes.thumshirn@edc.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lyl2019@mail.ustc.edu.cn \
--cc=martin.petersen@oracle.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;
as well as URLs for NNTP newsgroup(s).