Patch "crypto: sahara - fix processing hash requests with req->nbytes < sg->length" has been added to the 6.6-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: sahara - fix processing hash requests with req->nbytes < sg->length

to the 6.6-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-sahara-fix-processing-hash-requests-with-req-.patch
and it can be found in the queue-6.6 subdirectory.

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



commit 8d396ba7a67f0147b430801955765411c50fc85a
Author: Ovidiu Panait <ovidiu.panait@xxxxxxxxxxxxx>
Date:   Sun Dec 24 10:21:35 2023 +0200

    crypto: sahara - fix processing hash requests with req->nbytes < sg->length
    
    [ Upstream commit 7bafa74d1ba35dcc173e1ce915e983d65905f77e ]
    
    It's not always the case that the entire sg entry needs to be processed.
    Currently, when nbytes is less than sg->length, "Descriptor length" errors
    are encountered.
    
    To fix this, take the actual request size into account when populating the
    hw links.
    
    Fixes: 5a2bb93f5992 ("crypto: sahara - add support for SHA1/256")
    Signed-off-by: Ovidiu Panait <ovidiu.panait@xxxxxxxxxxxxx>
    Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
index 117aa4296c2a..477b4d8b450d 100644
--- a/drivers/crypto/sahara.c
+++ b/drivers/crypto/sahara.c
@@ -776,6 +776,7 @@ static int sahara_sha_hw_links_create(struct sahara_dev *dev,
 				       int start)
 {
 	struct scatterlist *sg;
+	unsigned int len;
 	unsigned int i;
 	int ret;
 
@@ -797,12 +798,14 @@ static int sahara_sha_hw_links_create(struct sahara_dev *dev,
 	if (!ret)
 		return -EFAULT;
 
+	len = rctx->total;
 	for (i = start; i < dev->nb_in_sg + start; i++) {
-		dev->hw_link[i]->len = sg->length;
+		dev->hw_link[i]->len = min(len, sg->length);
 		dev->hw_link[i]->p = sg->dma_address;
 		if (i == (dev->nb_in_sg + start - 1)) {
 			dev->hw_link[i]->next = 0;
 		} else {
+			len -= min(len, sg->length);
 			dev->hw_link[i]->next = dev->hw_phys_link[i + 1];
 			sg = sg_next(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