Patch "hwrng: arm-smccc-trng - fix NO_ENTROPY handling" has been added to the 5.15-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

    hwrng: arm-smccc-trng - fix NO_ENTROPY handling

to the 5.15-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:
     hwrng-arm-smccc-trng-fix-no_entropy-handling.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 2d6be98014d8b8f4a642a4da03282e46bf3e47be
Author: James Cowgill <james.cowgill@xxxxxxxxxx>
Date:   Mon Aug 1 20:04:18 2022 +0000

    hwrng: arm-smccc-trng - fix NO_ENTROPY handling
    
    [ Upstream commit 042b4b169c6fb9d4df268d66282d7302dd73d37b ]
    
    The SMCCC_RET_TRNG_NO_ENTROPY switch arm is never used because the
    NO_ENTROPY return value is negative and negative values are handled
    above the switch by immediately returning.
    
    Fix by handling errors using a default arm in the switch.
    
    Fixes: 0888d04b47a1 ("hwrng: Add Arm SMCCC TRNG based driver")
    Signed-off-by: James Cowgill <james.cowgill@xxxxxxxxxx>
    Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/char/hw_random/arm_smccc_trng.c b/drivers/char/hw_random/arm_smccc_trng.c
index b24ac39a903b..e34c3ea692b6 100644
--- a/drivers/char/hw_random/arm_smccc_trng.c
+++ b/drivers/char/hw_random/arm_smccc_trng.c
@@ -71,8 +71,6 @@ static int smccc_trng_read(struct hwrng *rng, void *data, size_t max, bool wait)
 				  MAX_BITS_PER_CALL);
 
 		arm_smccc_1_1_invoke(ARM_SMCCC_TRNG_RND, bits, &res);
-		if ((int)res.a0 < 0)
-			return (int)res.a0;
 
 		switch ((int)res.a0) {
 		case SMCCC_RET_SUCCESS:
@@ -88,6 +86,8 @@ static int smccc_trng_read(struct hwrng *rng, void *data, size_t max, bool wait)
 				return copied;
 			cond_resched();
 			break;
+		default:
+			return -EIO;
 		}
 	}
 



[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