linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: pciehp: Always protect pciehp_disable_slot() with hotplug mutex
@ 2015-11-01 21:58 Guenter Roeck
  2015-11-05  3:01 ` Rajat Jain
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Guenter Roeck @ 2015-11-01 21:58 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, linux-kernel, Guenter Roeck, Rajat Jain

When called from pciehp_sysfs_disable_slot(), the call to
pciehp_disable_slot() was not protected by the hotplug mutex.

Cc: Rajat Jain <rajatxjain@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: pciehp: Always protect pciehp_disable_slot() with hotplug mutex
  2015-11-01 21:58 [PATCH] PCI: pciehp: Always protect pciehp_disable_slot() with hotplug mutex Guenter Roeck
@ 2015-11-05  3:01 ` Rajat Jain
       [not found] ` <CAA93t1o1tFvZDiBNfU62q+sfiykVxKCAs_ZWJ-uDjyEWaLEwoQ@mail.gmail.com>
  2015-11-25 17:48 ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Rajat Jain @ 2015-11-05  3:01 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Bjorn Helgaas, linux-pci, linux-kernel

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

Reviewed-by: Rajat Jain <rajatxjain@gmail.com>

On Sun, Nov 1, 2015 at 1:58 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> When called from pciehp_sysfs_disable_slot(), the call to
> pciehp_disable_slot() was not protected by the hotplug mutex.
>
> Cc: Rajat Jain <rajatxjain@gmail.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  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
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: pciehp: Always protect pciehp_disable_slot() with hotplug mutex
       [not found] ` <CAA93t1o1tFvZDiBNfU62q+sfiykVxKCAs_ZWJ-uDjyEWaLEwoQ@mail.gmail.com>
@ 2015-11-05  5:14   ` Guenter Roeck
  0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2015-11-05  5:14 UTC (permalink / raw)
  To: rajatxjain; +Cc: Bjorn Helgaas, linux-pci, linux-kernel

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 <rajatxjain@gmail.com <mailto:rajatxjain@gmail.com>>
>
> On Sun, Nov 1, 2015 at 1:58 PM, Guenter Roeck <linux@roeck-us.net <mailto:linux@roeck-us.net>> wrote:
>
>     When called from pciehp_sysfs_disable_slot(), the call to
>     pciehp_disable_slot() was not protected by the hotplug mutex.
>
>     Cc: Rajat Jain <rajatxjain@gmail.com <mailto:rajatxjain@gmail.com>>
>     Signed-off-by: Guenter Roeck <linux@roeck-us.net <mailto:linux@roeck-us.net>>
>     ---
>       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
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: pciehp: Always protect pciehp_disable_slot() with hotplug mutex
  2015-11-01 21:58 [PATCH] PCI: pciehp: Always protect pciehp_disable_slot() with hotplug mutex Guenter Roeck
  2015-11-05  3:01 ` Rajat Jain
       [not found] ` <CAA93t1o1tFvZDiBNfU62q+sfiykVxKCAs_ZWJ-uDjyEWaLEwoQ@mail.gmail.com>
@ 2015-11-25 17:48 ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2015-11-25 17:48 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Bjorn Helgaas, linux-pci, linux-kernel, Rajat Jain

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 <rajatxjain@gmail.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-25 17:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-01 21:58 [PATCH] PCI: pciehp: Always protect pciehp_disable_slot() with hotplug mutex Guenter Roeck
2015-11-05  3:01 ` Rajat Jain
     [not found] ` <CAA93t1o1tFvZDiBNfU62q+sfiykVxKCAs_ZWJ-uDjyEWaLEwoQ@mail.gmail.com>
2015-11-05  5:14   ` Guenter Roeck
2015-11-25 17:48 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).