mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH stable-27 1/2] PCI hotplug: fix lock imbalance in pciehp
@ 2009-01-28 17:53 Jiri Slaby
  2009-01-28 17:53 ` [PATCH stable-27 2/2] relay: fix lock imbalance in relay_late_setup_files Jiri Slaby
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Slaby @ 2009-01-28 17:53 UTC (permalink / raw)
  To: greg; +Cc: chrisw, stable, linux-kernel, Jiri Slaby, Jesse Barnes

From: Jiri Slaby <jirislaby@gmail.com>

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.

Commit c2fdd36b550659f5ac2240d1f5a83ffa1a092289.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: 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 6e18736..6d9b074 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


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

* [PATCH stable-27 2/2] relay: fix lock imbalance in relay_late_setup_files
  2009-01-28 17:53 [PATCH stable-27 1/2] PCI hotplug: fix lock imbalance in pciehp Jiri Slaby
@ 2009-01-28 17:53 ` Jiri Slaby
  2009-01-28 17:53   ` [PATCH stable-28 1/3] NET: net_namespace, fix lock imbalance Jiri Slaby
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Slaby @ 2009-01-28 17:53 UTC (permalink / raw)
  To: greg; +Cc: chrisw, stable, linux-kernel, Jiri Slaby, Ingo Molnar

From: Jiri Slaby <jirislaby@gmail.com>

One fail path in relay_late_setup_files() omits
mutex_unlock(&relay_channels_mutex);
Add it.

Commit b786c6a98ef6fa81114ba7b9fbfc0d67060775e3.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/relay.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/kernel/relay.c b/kernel/relay.c
index 8d13a78..b0bbf6f 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -664,8 +664,10 @@ int relay_late_setup_files(struct rchan *chan,
 
 	mutex_lock(&relay_channels_mutex);
 	/* Is chan already set up? */
-	if (unlikely(chan->has_base_filename))
+	if (unlikely(chan->has_base_filename)) {
+		mutex_unlock(&relay_channels_mutex);
 		return -EEXIST;
+	}
 	chan->has_base_filename = 1;
 	chan->parent = parent;
 	curr_cpu = get_cpu();
-- 
1.6.1


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

* [PATCH stable-28 1/3] NET: net_namespace, fix lock imbalance
  2009-01-28 17:53 ` [PATCH stable-27 2/2] relay: fix lock imbalance in relay_late_setup_files Jiri Slaby
@ 2009-01-28 17:53   ` Jiri Slaby
  2009-01-28 17:53     ` [PATCH stable-28 2/3] PCI hotplug: fix lock imbalance in pciehp Jiri Slaby
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Slaby @ 2009-01-28 17:53 UTC (permalink / raw)
  To: greg; +Cc: chrisw, stable, linux-kernel, Jiri Slaby, David S. Miller

From: Jiri Slaby <jirislaby@gmail.com>

register_pernet_gen_subsys omits mutex_unlock in one fail path.
Fix it.

Commit 357f5b0b91054ae23385ea4b0634bb8b43736e83.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/core/net_namespace.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 1895a4c..0bc398c 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -342,8 +342,8 @@ again:
 	rv = register_pernet_operations(first_device, ops);
 	if (rv < 0)
 		ida_remove(&net_generic_ids, *id);
-	mutex_unlock(&net_mutex);
 out:
+	mutex_unlock(&net_mutex);
 	return rv;
 }
 EXPORT_SYMBOL_GPL(register_pernet_gen_subsys);
-- 
1.6.1


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

* [PATCH stable-28 2/3] PCI hotplug: fix lock imbalance in pciehp
  2009-01-28 17:53   ` [PATCH stable-28 1/3] NET: net_namespace, fix lock imbalance Jiri Slaby
@ 2009-01-28 17:53     ` Jiri Slaby
  2009-01-28 17:53       ` [PATCH stable-28 3/3] relay: fix lock imbalance in relay_late_setup_files Jiri Slaby
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Slaby @ 2009-01-28 17:53 UTC (permalink / raw)
  To: greg; +Cc: chrisw, stable, linux-kernel, Jiri Slaby, Jesse Barnes

From: Jiri Slaby <jirislaby@gmail.com>

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.

Commit c2fdd36b550659f5ac2240d1f5a83ffa1a092289.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: 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 39cf248..b2ecff4 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


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

* [PATCH stable-28 3/3] relay: fix lock imbalance in relay_late_setup_files
  2009-01-28 17:53     ` [PATCH stable-28 2/3] PCI hotplug: fix lock imbalance in pciehp Jiri Slaby
@ 2009-01-28 17:53       ` Jiri Slaby
  0 siblings, 0 replies; 5+ messages in thread
From: Jiri Slaby @ 2009-01-28 17:53 UTC (permalink / raw)
  To: greg; +Cc: chrisw, stable, linux-kernel, Jiri Slaby, Ingo Molnar

From: Jiri Slaby <jirislaby@gmail.com>

One fail path in relay_late_setup_files() omits
mutex_unlock(&relay_channels_mutex);
Add it.

Commit b786c6a98ef6fa81114ba7b9fbfc0d67060775e3.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/relay.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/kernel/relay.c b/kernel/relay.c
index 09ac200..9d79b78 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -663,8 +663,10 @@ int relay_late_setup_files(struct rchan *chan,
 
 	mutex_lock(&relay_channels_mutex);
 	/* Is chan already set up? */
-	if (unlikely(chan->has_base_filename))
+	if (unlikely(chan->has_base_filename)) {
+		mutex_unlock(&relay_channels_mutex);
 		return -EEXIST;
+	}
 	chan->has_base_filename = 1;
 	chan->parent = parent;
 	curr_cpu = get_cpu();
-- 
1.6.1


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

end of thread, other threads:[~2009-01-28 17:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-28 17:53 [PATCH stable-27 1/2] PCI hotplug: fix lock imbalance in pciehp Jiri Slaby
2009-01-28 17:53 ` [PATCH stable-27 2/2] relay: fix lock imbalance in relay_late_setup_files Jiri Slaby
2009-01-28 17:53   ` [PATCH stable-28 1/3] NET: net_namespace, fix lock imbalance Jiri Slaby
2009-01-28 17:53     ` [PATCH stable-28 2/3] PCI hotplug: fix lock imbalance in pciehp Jiri Slaby
2009-01-28 17:53       ` [PATCH stable-28 3/3] relay: fix lock imbalance in relay_late_setup_files Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®