Re: [PATCH] block: fix error handling for device_add_disk

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

 



On Tue, Dec 21, 2021 at 08:41:18PM +0900, Tetsuo Handa wrote:
> On 2021/12/21 4:16, Luis Chamberlain wrote:
> > The kobject_alive() tells us if at least the device_add() had the
> > kobject_add() complete.
> 
> 
> Testing with error injection
> 
> @@ -3284,6 +3284,9 @@ int device_add(struct device *dev)
>         if (!dev)
>                 goto done;
> 
> +       if (!strcmp(current->comm, "a.out"))
> +               goto done;
> +
>         if (!dev->p) {
>                 error = device_private_init(dev);
>                 if (error)
> 
> told me that kref count is 1 when reaching the out_disk_release_events label.
> Thus,
> 
> 	if (!kobject_alive(&ddev->kobj))
> 
> seems wrong.

Hrm.... quite unexpected.

> Christoph proposed deferring disk_alloc_events(). If it is safe to defer
> disk_alloc_events(), that can be a fix. 

*If safe*, yes, agreed.

  Luis



[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