* [PATCH] PCI: pciehp_core, fix lock imbalance
@ 2009-01-17 15:23 Jiri Slaby
2009-01-19 2:01 ` Kenji Kaneshige
2009-01-19 18:56 ` Jesse Barnes
0 siblings, 2 replies; 3+ messages in thread
From: Jiri Slaby @ 2009-01-17 15:23 UTC (permalink / raw)
To: jbarnes; +Cc: linux-pci, linux-kernel, Jiri Slaby, Kristen Carlson Accardi
set_lock_status omits mutex_unlock in fail path. Add the omitted
unlock.
As a result a lockup caused by this can be triggered from userspace
by writing 1 to /sys/bus/pci/slots/.../lock often enough.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
---
drivers/pci/hotplug/pciehp_core.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index 5482d4e..c248554 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -126,8 +126,10 @@ static int set_lock_status(struct hotplug_slot *hotplug_slot, u8 status)
mutex_lock(&slot->ctrl->crit_sect);
/* has it been >1 sec since our last toggle? */
- if ((get_seconds() - slot->last_emi_toggle) < 1)
+ if ((get_seconds() - slot->last_emi_toggle) < 1) {
+ mutex_unlock(&slot->ctrl->crit_sect);
return -EINVAL;
+ }
/* see what our current state is */
retval = get_lock_status(hotplug_slot, &value);
--
1.6.1
caught by stanse
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI: pciehp_core, fix lock imbalance
2009-01-17 15:23 [PATCH] PCI: pciehp_core, fix lock imbalance Jiri Slaby
@ 2009-01-19 2:01 ` Kenji Kaneshige
2009-01-19 18:56 ` Jesse Barnes
1 sibling, 0 replies; 3+ messages in thread
From: Kenji Kaneshige @ 2009-01-19 2:01 UTC (permalink / raw)
To: Jiri Slaby; +Cc: jbarnes, linux-pci, linux-kernel, Kristen Carlson Accardi
Jiri Slaby wrote:
> set_lock_status omits mutex_unlock in fail path. Add the omitted
> unlock.
>
> As a result a lockup caused by this can be triggered from userspace
> by writing 1 to /sys/bus/pci/slots/.../lock often enough.
>
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> Cc: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> ---
> drivers/pci/hotplug/pciehp_core.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
> index 5482d4e..c248554 100644
> --- a/drivers/pci/hotplug/pciehp_core.c
> +++ b/drivers/pci/hotplug/pciehp_core.c
> @@ -126,8 +126,10 @@ static int set_lock_status(struct hotplug_slot *hotplug_slot, u8 status)
> mutex_lock(&slot->ctrl->crit_sect);
>
> /* has it been >1 sec since our last toggle? */
> - if ((get_seconds() - slot->last_emi_toggle) < 1)
> + if ((get_seconds() - slot->last_emi_toggle) < 1) {
> + mutex_unlock(&slot->ctrl->crit_sect);
> return -EINVAL;
> + }
>
> /* see what our current state is */
> retval = get_lock_status(hotplug_slot, &value);
Good catch!
Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Thanks,
Kenji Kaneshige
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI: pciehp_core, fix lock imbalance
2009-01-17 15:23 [PATCH] PCI: pciehp_core, fix lock imbalance Jiri Slaby
2009-01-19 2:01 ` Kenji Kaneshige
@ 2009-01-19 18:56 ` Jesse Barnes
1 sibling, 0 replies; 3+ messages in thread
From: Jesse Barnes @ 2009-01-19 18:56 UTC (permalink / raw)
To: Jiri Slaby
Cc: linux-pci, linux-kernel, Kristen Carlson Accardi, Kenji Kaneshige
On Saturday, January 17, 2009 7:23 am Jiri Slaby wrote:
> set_lock_status omits mutex_unlock in fail path. Add the omitted
> unlock.
>
> As a result a lockup caused by this can be triggered from userspace
> by writing 1 to /sys/bus/pci/slots/.../lock often enough.
>
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> Cc: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> ---
> drivers/pci/hotplug/pciehp_core.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/pci/hotplug/pciehp_core.c
> b/drivers/pci/hotplug/pciehp_core.c index 5482d4e..c248554 100644
> --- a/drivers/pci/hotplug/pciehp_core.c
> +++ b/drivers/pci/hotplug/pciehp_core.c
> @@ -126,8 +126,10 @@ static int set_lock_status(struct hotplug_slot
> *hotplug_slot, u8 status) mutex_lock(&slot->ctrl->crit_sect);
>
> /* has it been >1 sec since our last toggle? */
> - if ((get_seconds() - slot->last_emi_toggle) < 1)
> + if ((get_seconds() - slot->last_emi_toggle) < 1) {
> + mutex_unlock(&slot->ctrl->crit_sect);
> return -EINVAL;
> + }
>
> /* see what our current state is */
> retval = get_lock_status(hotplug_slot, &value);
Applied to my for-linus branch (with Kenji-san's reviewed-by), thanks.
--
Jesse Barnes, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-01-19 18:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-17 15:23 [PATCH] PCI: pciehp_core, fix lock imbalance Jiri Slaby
2009-01-19 2:01 ` Kenji Kaneshige
2009-01-19 18:56 ` Jesse Barnes
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.