lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:  <20091229182201.1df596b4@mycelium.queued.net>
Date:	Tue, 29 Dec 2009 18:22:01 -0500
From:	Andres Salomon <dilinger@...ued.net>
To:	linux-kernel@...r.kernel.org
Cc:	linux-geode@...badil.infradead.org
Subject:  Re: 2.6.33-rc1: WARNING: at kernel/mutex-debug.c:78 (geode hw rng?)

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

> Hi,
> 
> not so sure if it is geode related.
> While starting rngd on 2.6.33-rc1 on a geode machine, I got this
> warning:
> 
> [   19.545852] ------------[ cut here ]------------
> [   19.547554] WARNING: at kernel/mutex-debug.c:78
> debug_mutex_unlock+0x78/0xb8()
> [   19.547554] Modules linked in: ipt_LOG iptable_nat nf_nat
> nf_conntrack_ipv4 nf_conntrack nf_defrag_ipv4 arc4 ecb ath5k ehci_hcd
> ohci_hcd mac80211 ath
> [   19.547554] Pid: 2509, comm: rngd Not tainted 2.6.33-rc1-ah0 #2
> [   19.547554] Call Trace:
> [   19.547554]  [<c102d86c>] ? debug_mutex_unlock+0x78/0xb8
> [   19.547554]  [<c10168bd>] warn_slowpath_common+0x60/0x77
> [   19.547554]  [<c10168e1>] warn_slowpath_null+0xd/0x10
> [   19.547554]  [<c102d86c>] debug_mutex_unlock+0x78/0xb8
> [   19.547554]  [<c1273314>] __mutex_unlock_slowpath+0x7b/0xa3
> [   19.547554]  [<c1273344>] mutex_unlock+0x8/0xa
> [   19.547554]  [<c116de8c>] rng_dev_read+0x13b/0x156
> [   19.547554]  [<c116dd51>] ? rng_dev_read+0x0/0x156
> [   19.547554]  [<c105ac23>] vfs_read+0x8a/0x11a
> [   19.547554]  [<c105af18>] sys_read+0x3b/0x60
> [   19.547554]  [<c127426d>] syscall_call+0x7/0xb
> [   19.547554] ---[ end trace cd1825d2e719f82e ]---
> 
> however, the system seems stable, and the hwrng seems to work fine...
> 
> Best regards,
> Arnd


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@...labora.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



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ