diff options
author | Greg Price <price@MIT.EDU> | 2013-11-29 20:09:37 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-03-19 22:18:51 -0400 |
commit | a58aa4edc6d2e779894b1fa95a2f4de157ff3b3b (patch) | |
tree | 9ae4c66ee56c768cdc6370a879154acbccb10133 /drivers/char | |
parent | ee1de406ba6eb1e01f143fe3351e70cc772cc63e (diff) |
random: forget lock in lockless accounting
The only mutable data accessed here is ->entropy_count, but since
10b3a32d2 ("random: fix accounting race condition") we use cmpxchg to
protect our accesses to ->entropy_count here. Drop the use of the
lock.
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Price <price@mit.edu>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/random.c | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index 9675821b4b5a..694510af4fcd 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -970,9 +970,6 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min, | |||
970 | int entropy_count, orig; | 970 | int entropy_count, orig; |
971 | size_t ibytes; | 971 | size_t ibytes; |
972 | 972 | ||
973 | /* Hold lock while accounting */ | ||
974 | spin_lock_irqsave(&r->lock, flags); | ||
975 | |||
976 | BUG_ON(r->entropy_count > r->poolinfo->poolfracbits); | 973 | BUG_ON(r->entropy_count > r->poolinfo->poolfracbits); |
977 | 974 | ||
978 | /* Can we pull enough? */ | 975 | /* Can we pull enough? */ |
@@ -995,7 +992,6 @@ retry: | |||
995 | < random_write_wakeup_thresh) | 992 | < random_write_wakeup_thresh) |
996 | wakeup_write = 1; | 993 | wakeup_write = 1; |
997 | } | 994 | } |
998 | spin_unlock_irqrestore(&r->lock, flags); | ||
999 | 995 | ||
1000 | trace_debit_entropy(r->name, 8 * ibytes); | 996 | trace_debit_entropy(r->name, 8 * ibytes); |
1001 | if (wakeup_write) { | 997 | if (wakeup_write) { |