Patch "s390/archrandom: add parameter check for s390_arch_random_generate" has been added to the 5.10-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

    s390/archrandom: add parameter check for s390_arch_random_generate

to the 5.10-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:
     s390-archrandom-add-parameter-check-for-s390_arch_ra.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 158ea589990fa43b5b5acf5bd99dc45a3116a8d7
Author: Harald Freudenberger <freude@xxxxxxxxxxxxx>
Date:   Tue Apr 20 08:23:12 2021 +0200

    s390/archrandom: add parameter check for s390_arch_random_generate
    
    [ Upstream commit 28096067686c5a5cbd4c35b079749bd805df5010 ]
    
    A review of the code showed, that this function which is exposed
    within the whole kernel should do a parameter check for the
    amount of bytes requested. If this requested bytes is too high
    an unsigned int overflow could happen causing this function to
    try to memcpy a really big memory chunk.
    
    This is not a security issue as there are only two invocations
    of this function from arch/s390/include/asm/archrandom.h and both
    are not exposed to userland.
    
    Reported-by: Sven Schnelle <svens@xxxxxxxxxxxxx>
    Signed-off-by: Harald Freudenberger <freude@xxxxxxxxxxxxx>
    Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/s390/crypto/arch_random.c b/arch/s390/crypto/arch_random.c
index dd95cdbd22ce..4cbb4b6d85a8 100644
--- a/arch/s390/crypto/arch_random.c
+++ b/arch/s390/crypto/arch_random.c
@@ -53,6 +53,10 @@ static DECLARE_DELAYED_WORK(arch_rng_work, arch_rng_refill_buffer);
 
 bool s390_arch_random_generate(u8 *buf, unsigned int nbytes)
 {
+	/* max hunk is ARCH_RNG_BUF_SIZE */
+	if (nbytes > ARCH_RNG_BUF_SIZE)
+		return false;
+
 	/* lock rng buffer */
 	if (!spin_trylock(&arch_rng_lock))
 		return false;



[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