Re: [PATCH V2 1/5] ublk_drv: avoid to leak ublk device in case that add_disk fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 27, 2022 at 06:21:32PM +0200, Christoph Hellwig wrote:
> maybe s/avoid/don't/ in the subject?

OK, will change in V3.

> 
> > -	get_device(&ub->cdev_dev);
> >  	ret = add_disk(disk);
> >  	if (ret) {
> >  		put_disk(disk);
> >  		goto out_unlock;
> 
> Maybe just add a put_device here in the error branch to keep
> things simple?

That is fine.

Another way is to add 'out_put_disk' error label which can be
reused with previous error handling.


Thanks,
Ming




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux