[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <434036d5-4610-3b60-74ba-5641cc2b9d5b@kernel.dk>
Date: Mon, 26 Apr 2021 09:05:04 -0600
From: Jens Axboe <axboe@...nel.dk>
To: Lv Yunlong <lyl2019@...l.ustc.edu.cn>, damien.lemoal@....com,
johannes.thumshirn@....com, martin.petersen@...cle.com
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drivers/block/null_blk/main: Fix a double free in
null_init.
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
Powered by blists - more mailing lists