Patch "crypto: img-hash - Fix variable dereferenced before check 'hdev->req'" 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

    crypto: img-hash - Fix variable dereferenced before check 'hdev->req'

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:
     crypto-img-hash-fix-variable-dereferenced-before-che.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 a794d26f18b9bf5808df393c7acc3c0379cad95c
Author: Gaosheng Cui <cuigaosheng1@xxxxxxxxxx>
Date:   Thu Dec 1 14:25:26 2022 +0800

    crypto: img-hash - Fix variable dereferenced before check 'hdev->req'
    
    [ Upstream commit 04ba54e5af8f8f0137b08cb51a0b3a2e1ea46c94 ]
    
    Smatch report warning as follows:
    
    drivers/crypto/img-hash.c:366 img_hash_dma_task() warn: variable
    dereferenced before check 'hdev->req'
    
    Variable dereferenced should be done after check 'hdev->req',
    fix it.
    
    Fixes: d358f1abbf71 ("crypto: img-hash - Add Imagination Technologies hw hash accelerator")
    Fixes: 10badea259fa ("crypto: img-hash - Fix null pointer exception")
    Signed-off-by: Gaosheng Cui <cuigaosheng1@xxxxxxxxxx>
    Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/crypto/img-hash.c b/drivers/crypto/img-hash.c
index 91f555ccbb31..cecae50d0f58 100644
--- a/drivers/crypto/img-hash.c
+++ b/drivers/crypto/img-hash.c
@@ -357,12 +357,16 @@ static int img_hash_dma_init(struct img_hash_dev *hdev)
 static void img_hash_dma_task(unsigned long d)
 {
 	struct img_hash_dev *hdev = (struct img_hash_dev *)d;
-	struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req);
+	struct img_hash_request_ctx *ctx;
 	u8 *addr;
 	size_t nbytes, bleft, wsend, len, tbc;
 	struct scatterlist tsg;
 
-	if (!hdev->req || !ctx->sg)
+	if (!hdev->req)
+		return;
+
+	ctx = ahash_request_ctx(hdev->req);
+	if (!ctx->sg)
 		return;
 
 	addr = sg_virt(ctx->sg);



[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