2015-11-01 21:58:45

by Guenter Roeck

[permalink] [raw]
Subject: [PATCH] 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.

Cc: Rajat Jain <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
---
drivers/pci/hotplug/pciehp_ctrl.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index 4c8f4cde6854..880978b6d534 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;
--
2.1.4


2015-11-05 03:01:16

by Rajat Jain

[permalink] [raw]
Subject: Re: [PATCH] PCI: pciehp: Always protect pciehp_disable_slot() with hotplug mutex

Geez... I wonder how did I miss it. Thanks for fixing this.
Looks good to me.

Reviewed-by: Rajat Jain <[email protected]>

On Sun, Nov 1, 2015 at 1:58 PM, Guenter Roeck <[email protected]> wrote:
> When called from pciehp_sysfs_disable_slot(), the call to
> pciehp_disable_slot() was not protected by the hotplug mutex.
>
> Cc: Rajat Jain <[email protected]>
> Signed-off-by: Guenter Roeck <[email protected]>
> ---
> drivers/pci/hotplug/pciehp_ctrl.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
> index 4c8f4cde6854..880978b6d534 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;
> --
> 2.1.4
>

2015-11-05 05:15:03

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH] PCI: pciehp: Always protect pciehp_disable_slot() with hotplug mutex

On 11/04/2015 06:59 PM, Rajat Jain wrote:
> Geez... I wonder how did I miss it. Thanks for fixing this.
> Looks good to me.
>
Hi Rajat,

easy to miss. I only found it accidentally.

Thanks a lot for the review!

Guenter

> Reviewed-by: Rajat Jain <[email protected] <mailto:[email protected]>>
>
> On Sun, Nov 1, 2015 at 1:58 PM, Guenter Roeck <[email protected] <mailto:[email protected]>> wrote:
>
> When called from pciehp_sysfs_disable_slot(), the call to
> pciehp_disable_slot() was not protected by the hotplug mutex.
>
> Cc: Rajat Jain <[email protected] <mailto:[email protected]>>
> Signed-off-by: Guenter Roeck <[email protected] <mailto:[email protected]>>
> ---
> drivers/pci/hotplug/pciehp_ctrl.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
> index 4c8f4cde6854..880978b6d534 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;
> --
> 2.1.4
>
>

2015-11-25 17:48:30

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: [PATCH] PCI: pciehp: Always protect pciehp_disable_slot() with hotplug mutex

On Sun, Nov 01, 2015 at 01:58:40PM -0800, Guenter Roeck wrote:
> When called from pciehp_sysfs_disable_slot(), the call to
> pciehp_disable_slot() was not protected by the hotplug mutex.
>
> Cc: Rajat Jain <[email protected]>
> Signed-off-by: Guenter Roeck <[email protected]>

Applied with Rajat's Reviewed-by to pci/hotplug for v4.5, thanks!

> ---
> drivers/pci/hotplug/pciehp_ctrl.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
> index 4c8f4cde6854..880978b6d534 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;
> --
> 2.1.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html