Patch "crypto: api - Add scaffolding to change completion function signature" has been added to the 6.2-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: api - Add scaffolding to change completion function signature

to the 6.2-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-api-add-scaffolding-to-change-completion-func.patch
and it can be found in the queue-6.2 subdirectory.

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



commit b706c3e9325a71e8f3c86250bf171aae19dbde14
Author: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Date:   Tue Jan 31 16:01:45 2023 +0800

    crypto: api - Add scaffolding to change completion function signature
    
    [ Upstream commit c35e03eaece71101ff6cbf776b86403860ac8cc3 ]
    
    The crypto completion function currently takes a pointer to a
    struct crypto_async_request object.  However, in reality the API
    does not allow the use of any part of the object apart from the
    data field.  For example, ahash/shash will create a fake object
    on the stack to pass along a different data field.
    
    This leads to potential bugs where the user may try to dereference
    or otherwise use the crypto_async_request object.
    
    This patch adds some temporary scaffolding so that the completion
    function can take a void * instead.  Once affected users have been
    converted this can be removed.
    
    The helper crypto_request_complete will remain even after the
    conversion is complete.  It should be used instead of calling
    the completion function directly.
    
    Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
    Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@xxxxxxxxx>
    Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
    Stable-dep-of: 4140aafcff16 ("crypto: engine - fix crypto_queue backlog handling")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index 61b327206b557..1fd81e74a174f 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -302,4 +302,11 @@ enum {
 	CRYPTO_MSG_ALG_LOADED,
 };
 
+static inline void crypto_request_complete(struct crypto_async_request *req,
+					   int err)
+{
+	crypto_completion_t complete = req->complete;
+	complete(req, err);
+}
+
 #endif	/* _CRYPTO_ALGAPI_H */
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 5d1e961f810ec..b18f6e669fb10 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -176,6 +176,7 @@ struct crypto_async_request;
 struct crypto_tfm;
 struct crypto_type;
 
+typedef struct crypto_async_request crypto_completion_data_t;
 typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err);
 
 /**
@@ -595,6 +596,11 @@ struct crypto_wait {
 /*
  * Async ops completion helper functioons
  */
+static inline void *crypto_get_completion_data(crypto_completion_data_t *req)
+{
+	return req->data;
+}
+
 void crypto_req_done(struct crypto_async_request *req, int err);
 
 static inline int crypto_wait_req(int err, struct crypto_wait *wait)



[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