]> git.karo-electronics.de Git - linux-beck.git/commitdiff
PCI: pciehp: Always protect pciehp_disable_slot() with hotplug mutex
authorGuenter Roeck <linux@roeck-us.net>
Sun, 1 Nov 2015 21:58:40 +0000 (13:58 -0800)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 25 Nov 2015 17:45:42 +0000 (11:45 -0600)
When called from pciehp_sysfs_disable_slot(), the call to
pciehp_disable_slot() was not protected by the hotplug mutex.

Hold slot->hotplug_lock while calling pciehp_disable_slot().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Rajat Jain <rajatxjain@gmail.com>
drivers/pci/hotplug/pciehp_ctrl.c

index 4c8f4cde68540933e0a7c83ac8011bfd68d561e7..880978b6d534cf2f03417b483c8acfde359ea9c6 100644 (file)
@@ -511,7 +511,9 @@ int pciehp_sysfs_disable_slot(struct slot *p_slot)
        case STATIC_STATE:
                p_slot->state = POWEROFF_STATE;
                mutex_unlock(&p_slot->lock);
+               mutex_lock(&p_slot->hotplug_lock);
                retval = pciehp_disable_slot(p_slot);
+               mutex_unlock(&p_slot->hotplug_lock);
                mutex_lock(&p_slot->lock);
                p_slot->state = STATIC_STATE;
                break;