random: don't reset crng_init_cnt on urandom_read()
[platform/kernel/linux-starfive.git] / drivers / char / random.c
index 17ec609..227fb78 100644 (file)
@@ -1831,7 +1831,6 @@ urandom_read_nowarn(struct file *file, char __user *buf, size_t nbytes,
 static ssize_t
 urandom_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
 {
-       unsigned long flags;
        static int maxwarn = 10;
 
        if (!crng_ready() && maxwarn > 0) {
@@ -1839,9 +1838,6 @@ urandom_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
                if (__ratelimit(&urandom_warning))
                        pr_notice("%s: uninitialized urandom read (%zd bytes read)\n",
                                  current->comm, nbytes);
-               spin_lock_irqsave(&primary_crng.lock, flags);
-               crng_init_cnt = 0;
-               spin_unlock_irqrestore(&primary_crng.lock, flags);
        }
 
        return urandom_read_nowarn(file, buf, nbytes, ppos);