Commit e4add020 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'random-6.9-rc5-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/crng/random

Pull random number generator fixes from Jason Donenfeld:

 - The input subsystem contributes entropy in some places where a
   spinlock is held, but the entropy accounting code only handled
   callers being in an interrupt or non-atomic process context, but not
   atomic process context. We fix this by removing an optimization and
   just calling queue_work() unconditionally.

 - Greg accidently sent up a patch not intended for his tree and that
   had been nack'd, so that's now reverted.

* tag 'random-6.9-rc5-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/crng/random:
  Revert "vmgenid: emit uevent when VMGENID updates"
  random: handle creditable entropy from atomic process context
parents c2d88559 3aadf100
...@@ -702,7 +702,7 @@ static void extract_entropy(void *buf, size_t len) ...@@ -702,7 +702,7 @@ static void extract_entropy(void *buf, size_t len)
static void __cold _credit_init_bits(size_t bits) static void __cold _credit_init_bits(size_t bits)
{ {
static struct execute_work set_ready; static DECLARE_WORK(set_ready, crng_set_ready);
unsigned int new, orig, add; unsigned int new, orig, add;
unsigned long flags; unsigned long flags;
...@@ -718,8 +718,8 @@ static void __cold _credit_init_bits(size_t bits) ...@@ -718,8 +718,8 @@ static void __cold _credit_init_bits(size_t bits)
if (orig < POOL_READY_BITS && new >= POOL_READY_BITS) { if (orig < POOL_READY_BITS && new >= POOL_READY_BITS) {
crng_reseed(NULL); /* Sets crng_init to CRNG_READY under base_crng.lock. */ crng_reseed(NULL); /* Sets crng_init to CRNG_READY under base_crng.lock. */
if (static_key_initialized) if (static_key_initialized && system_unbound_wq)
execute_in_process_context(crng_set_ready, &set_ready); queue_work(system_unbound_wq, &set_ready);
atomic_notifier_call_chain(&random_ready_notifier, 0, NULL); atomic_notifier_call_chain(&random_ready_notifier, 0, NULL);
wake_up_interruptible(&crng_init_wait); wake_up_interruptible(&crng_init_wait);
kill_fasync(&fasync, SIGIO, POLL_IN); kill_fasync(&fasync, SIGIO, POLL_IN);
...@@ -890,8 +890,8 @@ void __init random_init(void) ...@@ -890,8 +890,8 @@ void __init random_init(void)
/* /*
* If we were initialized by the cpu or bootloader before jump labels * If we were initialized by the cpu or bootloader before jump labels
* are initialized, then we should enable the static branch here, where * or workqueues are initialized, then we should enable the static
* it's guaranteed that jump labels have been initialized. * branch here, where it's guaranteed that these have been initialized.
*/ */
if (!static_branch_likely(&crng_is_ready) && crng_init >= CRNG_READY) if (!static_branch_likely(&crng_is_ready) && crng_init >= CRNG_READY)
crng_set_ready(NULL); crng_set_ready(NULL);
......
...@@ -68,7 +68,6 @@ static int vmgenid_add(struct acpi_device *device) ...@@ -68,7 +68,6 @@ static int vmgenid_add(struct acpi_device *device)
static void vmgenid_notify(struct acpi_device *device, u32 event) static void vmgenid_notify(struct acpi_device *device, u32 event)
{ {
struct vmgenid_state *state = acpi_driver_data(device); struct vmgenid_state *state = acpi_driver_data(device);
char *envp[] = { "NEW_VMGENID=1", NULL };
u8 old_id[VMGENID_SIZE]; u8 old_id[VMGENID_SIZE];
memcpy(old_id, state->this_id, sizeof(old_id)); memcpy(old_id, state->this_id, sizeof(old_id));
...@@ -76,7 +75,6 @@ static void vmgenid_notify(struct acpi_device *device, u32 event) ...@@ -76,7 +75,6 @@ static void vmgenid_notify(struct acpi_device *device, u32 event)
if (!memcmp(old_id, state->this_id, sizeof(old_id))) if (!memcmp(old_id, state->this_id, sizeof(old_id)))
return; return;
add_vmfork_randomness(state->this_id, sizeof(state->this_id)); add_vmfork_randomness(state->this_id, sizeof(state->this_id));
kobject_uevent_env(&device->dev.kobj, KOBJ_CHANGE, envp);
} }
static const struct acpi_device_id vmgenid_ids[] = { static const struct acpi_device_id vmgenid_ids[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment