summaryrefslogtreecommitdiff
path: root/drivers/char/hw_random
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-12-23 18:22:34 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2009-12-23 18:22:34 +0300
commitf5908267b67917b8cbd98b27fd2be9b5f62ec76f (patch)
treedd3dcc47efa84d218c537dc47ea414b543abaf1c /drivers/char/hw_random
parent55639353a0035052d9ea6cfe4dde0ac7fcbb2c9f (diff)
downloadlinux-f5908267b67917b8cbd98b27fd2be9b5f62ec76f.tar.xz
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 <error27@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/char/hw_random')
-rw-r--r--drivers/char/hw_random/core.c5
1 files changed, 3 insertions, 2 deletions
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;
}