Patch "random: wake up /dev/random writers after zap" has been added to the 5.16-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    random: wake up /dev/random writers after zap

to the 5.16-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     random-wake-up-dev-random-writers-after-zap.patch
and it can be found in the queue-5.16 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 8117aa36f6b7e3e28f6b285915cd2536cfc95a65
Author: Jason A. Donenfeld <Jason@xxxxxxxxx>
Date:   Fri Jan 28 23:44:03 2022 +0100

    random: wake up /dev/random writers after zap
    
    [ Upstream commit 042e293e16e3aa9794ce60c29f5b7b0c8170f933 ]
    
    When account() is called, and the amount of entropy dips below
    random_write_wakeup_bits, we wake up the random writers, so that they
    can write some more in. However, the RNDZAPENTCNT/RNDCLEARPOOL ioctl
    sets the entropy count to zero -- a potential reduction just like
    account() -- but does not unblock writers. This commit adds the missing
    logic to that ioctl to unblock waiting writers.
    
    Reviewed-by: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Jason A. Donenfeld <Jason@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/char/random.c b/drivers/char/random.c
index a27ae3999ff32..ebe86de9d0acc 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1963,7 +1963,10 @@ static long random_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
 		 */
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
-		input_pool.entropy_count = 0;
+		if (xchg(&input_pool.entropy_count, 0) && random_write_wakeup_bits) {
+			wake_up_interruptible(&random_write_wait);
+			kill_fasync(&fasync, SIGIO, POLL_OUT);
+		}
 		return 0;
 	case RNDRESEEDCRNG:
 		if (!capable(CAP_SYS_ADMIN))



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux