Re: [PATCH] PCI: fix kernel oops on bridge rmoval

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

 



* Kenji Kaneshige <kaneshige.kenji@xxxxxxxxxxxxxx>:
> Kenji Kaneshige wrote:
>> Alex Chiang wrote:
>>> diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c
>>> index 2118944..459d6a2 100644
>>> --- a/drivers/pci/slot.c
>>> +++ b/drivers/pci/slot.c
>>> @@ -248,6 +248,7 @@ placeholder:
>>>          if (PCI_SLOT(dev->devfn) == slot_nr)
>>>              dev->slot = slot;
>>>  +    get_device(&parent->dev);
>>>      dev_dbg(&parent->dev, "dev %02x, created physical slot %s\n",
>>>          slot_nr, pci_slot_name(slot));
>>>  @@ -302,6 +303,7 @@ void pci_destroy_slot(struct pci_slot *slot)
>>>          slot->number, atomic_read(&slot->kobj.kref.refcount) - 1);
>>>       down_write(&pci_bus_sem);
>>> +    put_device(&slot->bus->dev);
>>>      kobject_put(&slot->kobj);
>>>      up_write(&pci_bus_sem);
>>>  }
>>>
>>
>> I've not tried your patch yet, but I don't think it works because
>> pci_create_slot() can be executed by some hotplug drivers (pciehp,
>> shpchp, ...) before parent->dev is initialized.
>>
>> Anyway, I'll try it and report the result as soon as possible.
>>
>
> I tried your patch. The result is that the patch doesn't fix anything
> and introduces new kernel oops (see below). I can reproduce the new
> kernel oops by the following steps.
>
> (1) Load pciehp
> (2) Remove parent bridge of the slot
> (3) Add parent bridge of the slot
>
> I think the reason why your patch doesn't fix the problem is the place
> of put_device() is wrong. It needs to be placed after kobject_put(),
> doesn't it?

You are right.

> And the reason why your patch introduce the new kernel oops is
> get_device(&parent->dev) is executed before parent->dev is initialized,
> as I mentioned in the previous e-mail.

Sigh, you are right again. I tested with acpiphp which does not
have that issue. Sorry for the noise.

I'll try and think of something else. :-/

Thanks.

/ac

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux