Re: 2.6.33-rc1: WARNING: at kernel/mutex-debug.c:78 (geode hw rng?)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andres Salomon
Date: Tuesday, December 29, 2009 - 4:22 pm

On Sun, 20 Dec 2009 01:44:56 +0100
Arnd Hannemann <hannemann@nets.rwth-aachen.de> wrote:



Hm, I suspect that 9996508b is the culprit.  Does the following patch
help?



Subject: [PATCH] hw_random: don't attempt to unlock mutex twice

Commit 9996508b reworked rng_dev_read such that we unlock rng_mutex
after exiting the loop; however, we also unlock it inside the loop
before exiting.  The out_unlock label should only be reached manually.

This code is starting to reach goto-considered-harmful territory. :/

Signed-off-by: Andres Salomon <dilinger@collabora.co.uk>
---
 drivers/char/hw_random/core.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index e989f67..29a5f6a 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -157,6 +157,9 @@ static ssize_t rng_dev_read(struct file *filp, char __user *buf,
 			err = -ERESTARTSYS;
 			goto out;
 		}
+
+		if (!size)
+			goto out;
 	}
 out_unlock:
 	mutex_unlock(&rng_mutex);
-- 
1.5.6.5



--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: 2.6.33-rc1: WARNING: at kernel/mutex-debug.c:78 (geode ..., Andres Salomon, (Tue Dec 29, 4:22 pm)