Re: [PATCH 1/8] block: delay freeing the gendisk

Ming Lei
2021-07-22T02:05:51Z

On Wed, Jul 21, 2021 at 05:35:16PM +0200, Christoph Hellwig wrote:
> blkdev_get_no_open acquires a reference to the block_device through
> the block device inode and then tries to acquire a device model
> reference to the gendisk. But at this point the disk migh already
> be freed (although the race is free). Fix this by only freeing the
> gendisk from the whole device bdevs ->free_inode callback as well.
>
> Fixes: 22ae8ce8b892 ("block: simplify bdev/disk lookup in blkdev_get")
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Ming Lei <ming.lei@redhat.com>

--
Ming