Skip to content

Commit

Permalink
hwrng: core - Fix double unlock in rng_dev_read
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Herbert Xu committed Dec 23, 2009
1 parent 5563935 commit f590826
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/char/hw_random/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand Down

0 comments on commit f590826

Please sign in to comment.