Skip to content

Commit b34fbaa

Browse files
Ingo Molnartytso
authored andcommitted
random: remove preempt disabled region
No need to keep preemption disabled across the whole function. mix_pool_bytes() uses a spin_lock() to protect the pool and there are other places like write_pool() whhich invoke mix_pool_bytes() without disabling preemption. credit_entropy_bits() is invoked from other places like add_hwgenerator_randomness() without disabling preemption. Before commit 95b709b ("random: drop trickle mode") the function used __this_cpu_inc_return() which would require disabled preemption. The preempt_disable() section was added in commit 43d5d30 ("[PATCH] random driver preempt robustness", history tree). It was claimed that the code relied on "vt_ioctl() being called under BKL". Cc: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> [bigeasy: enhance the commit message] Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent 39a8883 commit b34fbaa

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

drivers/char/random.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,8 +1131,6 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num)
11311131
} sample;
11321132
long delta, delta2, delta3;
11331133

1134-
preempt_disable();
1135-
11361134
sample.jiffies = jiffies;
11371135
sample.cycles = random_get_entropy();
11381136
sample.num = num;
@@ -1170,8 +1168,6 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num)
11701168
* and limit entropy entimate to 12 bits.
11711169
*/
11721170
credit_entropy_bits(r, min_t(int, fls(delta>>1), 11));
1173-
1174-
preempt_enable();
11751171
}
11761172

11771173
void add_input_randomness(unsigned int type, unsigned int code,

0 commit comments

Comments
 (0)