From: Herbert Xu Date: Wed, 23 Dec 2009 15:22:34 +0000 (+0800) Subject: hwrng: core - Fix double unlock in rng_dev_read X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=f5908267b67917b8cbd98b27fd2be9b5f62ec76f;p=openwrt%2Fstaging%2Fblogic.git hwrng: core - Fix double unlock in rng_dev_read When the loop terminates with size == 0 in rng_dev_read we will unlock the rng mutex twice. Reported-by: Dan Carpenter Signed-off-by: Herbert Xu --- diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index e989f67bb61f..3d9c61e5acbf 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c @@ -158,10 +158,11 @@ static ssize_t rng_dev_read(struct file *filp, char __user *buf, goto out; } } -out_unlock: - mutex_unlock(&rng_mutex); out: return ret ? : err; +out_unlock: + mutex_unlock(&rng_mutex); + goto out; }