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

Christian Brauner
2024-02-01T14:52:55Z

On Thu, Feb 01, 2024 at 12:23:47PM +0100, Jan Kara wrote:
> 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...

Bah, called twice instead of removed it. Fixed.