mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 12:10:52 -04:00
PCI: hv: Delete the device earlier from hbus->children for hot-remove
After we send a PCI_EJECTION_COMPLETE message to the host, the host will immediately send us a PCI_BUS_RELATIONS message with relations->device_count == 0, so pci_devices_present_work(), running on another thread, can find the being-ejected device, mark the hpdev->reported_missing to true, and run list_move_tail()/list_del() for the device -- this races hv_eject_device_work() -> list_del(). Move the list_del() in hv_eject_device_work() to an earlier place, i.e., before we send PCI_EJECTION_COMPLETE, so later the pci_devices_present_work() can't see the device. Signed-off-by: Dexuan Cui <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Jake Oshins <[email protected]> Acked-by: K. Y. Srinivasan <[email protected]> CC: Haiyang Zhang <[email protected]> CC: Vitaly Kuznetsov <[email protected]>
This commit is contained in:
parent
17978524a6
commit
e74d2ebdda
1 changed files with 4 additions and 4 deletions
|
|
@ -1582,6 +1582,10 @@ static void hv_eject_device_work(struct work_struct *work)
|
|||
pci_dev_put(pdev);
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&hpdev->hbus->device_list_lock, flags);
|
||||
list_del(&hpdev->list_entry);
|
||||
spin_unlock_irqrestore(&hpdev->hbus->device_list_lock, flags);
|
||||
|
||||
memset(&ctxt, 0, sizeof(ctxt));
|
||||
ejct_pkt = (struct pci_eject_response *)&ctxt.pkt.message;
|
||||
ejct_pkt->message_type.type = PCI_EJECTION_COMPLETE;
|
||||
|
|
@ -1590,10 +1594,6 @@ static void hv_eject_device_work(struct work_struct *work)
|
|||
sizeof(*ejct_pkt), (unsigned long)&ctxt.pkt,
|
||||
VM_PKT_DATA_INBAND, 0);
|
||||
|
||||
spin_lock_irqsave(&hpdev->hbus->device_list_lock, flags);
|
||||
list_del(&hpdev->list_entry);
|
||||
spin_unlock_irqrestore(&hpdev->hbus->device_list_lock, flags);
|
||||
|
||||
put_pcichild(hpdev, hv_pcidev_ref_childlist);
|
||||
put_pcichild(hpdev, hv_pcidev_ref_pnp);
|
||||
put_hvpcibus(hpdev->hbus);
|
||||
|
|
|
|||
Loading…
Reference in a new issue