diff mbox series

virtio-crypto: Do not use GFP_ATOMIC when not needed

Message ID 00f487d16bf9fc5ce215c44bed3f11df5adf266a.1675544037.git.christophe.jaillet@wanadoo.fr
State Accepted
Commit 4409c08d806721f0be80bf1c6537a983289272ed
Headers show
Series virtio-crypto: Do not use GFP_ATOMIC when not needed | expand

Commit Message

Christophe JAILLET Feb. 4, 2023, 8:54 p.m. UTC
There is no need to use GFP_ATOMIC here. GFP_KERNEL is already used for
another memory allocation just the line after.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is speculative ! ! !

Maybe it is the other memory allocation that should use GFP_ATOMIC.

Review with care !
---
 drivers/crypto/virtio/virtio_crypto_akcipher_algs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Herbert Xu Feb. 10, 2023, 9:49 a.m. UTC | #1
On Sat, Feb 04, 2023 at 09:54:08PM +0100, Christophe JAILLET wrote:
> There is no need to use GFP_ATOMIC here. GFP_KERNEL is already used for
> another memory allocation just the line after.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> This patch is speculative ! ! !
> 
> Maybe it is the other memory allocation that should use GFP_ATOMIC.
> 
> Review with care !

Looks correct to me.  We don't support calling akcipher in atomic
contexts.

> ---
>  drivers/crypto/virtio/virtio_crypto_akcipher_algs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c b/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c
index b2979be613b8..6963344f6a3a 100644
--- a/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c
+++ b/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c
@@ -116,7 +116,7 @@  static int virtio_crypto_alg_akcipher_init_session(struct virtio_crypto_akcipher
 	struct virtio_crypto_session_input *input;
 	struct virtio_crypto_ctrl_request *vc_ctrl_req;
 
-	pkey = kmemdup(key, keylen, GFP_ATOMIC);
+	pkey = kmemdup(key, keylen, GFP_KERNEL);
 	if (!pkey)
 		return -ENOMEM;