[079/119] sparc: Move of_set_property_mutex acquisition outside of devtree_lock grab.

Greg KH
2009-12-07T00:23:41Z

[-- Attachment #1: sparc-move-of_set_property_mutex-acquisition-outside-of-devtree_lock-grab.patch --]
[-- Type: text/plain, Size: 1256 bytes --]

2.6.31-stable review patch. If anyone has any objections, please let us know.

------------------
From: David S. Miller <davem@davemloft.net>

[ Upstream commit 1c9d80ddc60f8ac26344ec3db9830e5f8016c16d ]

Otherwise we try to sleep with preemption disabled, etc.

Noticed by Thomas Gleixner.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
arch/sparc/kernel/prom_common.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/sparc/kernel/prom_common.c
+++ b/arch/sparc/kernel/prom_common.c
@@ -76,6 +76,7 @@ int of_set_property(struct device_node *

err = -ENODEV;

+ mutex_lock(&of_set_property_mutex);
write_lock(&devtree_lock);
prevp = &dp->properties;
while (*prevp) {
@@ -85,9 +86,7 @@ int of_set_property(struct device_node *
void *old_val = prop->value;
int ret;

- mutex_lock(&of_set_property_mutex);
ret = prom_setprop(dp->node, name, val, len);
- mutex_unlock(&of_set_property_mutex);

err = -EINVAL;
if (ret >= 0) {
@@ -106,6 +105,7 @@ int of_set_property(struct device_node *
prevp = &(*prevp)->next;
}
write_unlock(&devtree_lock);
+ mutex_unlock(&of_set_property_mutex);

/* XXX Upate procfs if necessary... */