UBUNTU: SAUCE: PCI: vmd: guard device addition and removal
BugLink: https://bugs.launchpad.net/bugs/2011389
vmd may fail to create sysfs entry while `pci_rescan_bus()` called in
some other drivers like wwan.
sysfs: cannot create duplicate filename '/devices/.../resource0'
Call Trace:
<TASK>
sysfs_warn_dup.cold+0x17/0x34
sysfs_add_bin_file_mode_ns+0xc0/0xf0
sysfs_create_bin_file+0x6d/0xb0
pci_create_attr+0x117/0x260
pci_create_resource_files+0x6b/0x150
pci_create_sysfs_dev_files+0x18/0x30
pci_bus_add_device+0x30/0x80
pci_bus_add_devices+0x31/0x80
pci_bus_add_devices+0x5b/0x80
vmd_enable_domain.constprop.0+0x6b7/0x880 [vmd]
vmd_probe+0x16d/0x193 [vmd]
Fixes: 185a383ada ("x86/PCI: Add driver for Intel Volume Management Device (VMD)")
Suggested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: You-Sheng Yang (vicamo) <vicamo.yang@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
This commit is contained in:
committed by
Paolo Pisati
parent
f5844a1e36
commit
e2b1afd8f9
@@ -907,9 +907,13 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
|
||||
pci_add_resource_offset(&resources, &vmd->resources[1], offset[0]);
|
||||
pci_add_resource_offset(&resources, &vmd->resources[2], offset[1]);
|
||||
|
||||
pci_lock_rescan_remove();
|
||||
|
||||
vmd->bus = pci_create_root_bus(&vmd->dev->dev, vmd->busn_start,
|
||||
&vmd_ops, sd, &resources);
|
||||
if (!vmd->bus) {
|
||||
pci_unlock_rescan_remove();
|
||||
|
||||
pci_free_resource_list(&resources);
|
||||
vmd_remove_irq_domain(vmd);
|
||||
return -ENODEV;
|
||||
@@ -965,6 +969,8 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
|
||||
|
||||
vmd_acpi_end();
|
||||
|
||||
pci_unlock_rescan_remove();
|
||||
|
||||
WARN(sysfs_create_link(&vmd->dev->dev.kobj, &vmd->bus->dev.kobj,
|
||||
"domain"), "Can't create symlink to domain\n");
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user