Re: [PATCH v2 29/34] bdev: make struct bdev_handle private to the block layer

Jan Kara
2024-02-01T11:23:53Z

On Tue 23-01-24 14:26:46, Christian Brauner wrote:
> Signed-off-by: Christian Brauner <brauner@kernel.org>

One more thing I've noticed:

> -struct bdev_handle *bdev_open_by_dev(dev_t dev, blk_mode_t mode, void *holder,
> - const struct blk_holder_ops *hops)
> +int bdev_open(struct block_device *bdev, blk_mode_t mode, void *holder,
> + const struct blk_holder_ops *hops, struct file *bdev_file)
> {
> struct bdev_handle *handle = kmalloc(sizeof(struct bdev_handle),
> GFP_KERNEL);
> - struct block_device *bdev;
> bool unblock_events = true;
> - struct gendisk *disk;
> + struct gendisk *disk = bdev->bd_disk;
> int ret;
>
> + handle = kmalloc(sizeof(struct bdev_handle), GFP_KERNEL);

You are leaking handle here. It gets fixed up later in the series but
still...

Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR