From: Guenter Roeck Date: Sun, 1 Nov 2015 21:58:40 +0000 (-0800) Subject: PCI: pciehp: Always protect pciehp_disable_slot() with hotplug mutex X-Git-Tag: v4.5-rc1~33^2~6^3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=64609eaab242d36e3e3b7cb81d31a028719feb74;p=thirdparty%2Fkernel%2Flinux.git PCI: pciehp: Always protect pciehp_disable_slot() with hotplug mutex 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 Signed-off-by: Bjorn Helgaas Reviewed-by: Rajat Jain --- diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index 4c8f4cde68540..880978b6d534c 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c @@ -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;