linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: caam - fix printing on xts fallback allocation error path
@ 2020-11-01 20:05 Horia Geantă
  2020-11-02 10:49 ` Iuliana Prodan
  2020-11-06  7:03 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Horia Geantă @ 2020-11-01 20:05 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Aymen Sghaier
  Cc: Andrei Botila, linux-crypto, NXP Linux Team, linux-kernel

At the time xts fallback tfm allocation fails the device struct
hasn't been enabled yet in the caam xts tfm's private context.

Fix this by using the device struct from xts algorithm's private context
or, when not available, by replacing dev_err with pr_err.

Fixes: 9d9b14dbe077 ("crypto: caam/jr - add fallback for XTS with more than 8B IV")
Fixes: 83e8aa912138 ("crypto: caam/qi - add fallback for XTS with more than 8B IV")
Fixes: 36e2d7cfdcf1 ("crypto: caam/qi2 - add fallback for XTS with more than 8B IV")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
---
 drivers/crypto/caam/caamalg.c     | 4 ++--
 drivers/crypto/caam/caamalg_qi.c  | 4 ++--
 drivers/crypto/caam/caamalg_qi2.c | 3 ++-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
index cf5bd7666dfc..8697ae53b063 100644
--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -3404,8 +3404,8 @@ static int caam_cra_init(struct crypto_skcipher *tfm)
 		fallback = crypto_alloc_skcipher(tfm_name, 0,
 						 CRYPTO_ALG_NEED_FALLBACK);
 		if (IS_ERR(fallback)) {
-			dev_err(ctx->jrdev, "Failed to allocate %s fallback: %ld\n",
-				tfm_name, PTR_ERR(fallback));
+			pr_err("Failed to allocate %s fallback: %ld\n",
+			       tfm_name, PTR_ERR(fallback));
 			return PTR_ERR(fallback);
 		}
 
diff --git a/drivers/crypto/caam/caamalg_qi.c b/drivers/crypto/caam/caamalg_qi.c
index 66f60d78bdc8..a24ae966df4a 100644
--- a/drivers/crypto/caam/caamalg_qi.c
+++ b/drivers/crypto/caam/caamalg_qi.c
@@ -2502,8 +2502,8 @@ static int caam_cra_init(struct crypto_skcipher *tfm)
 		fallback = crypto_alloc_skcipher(tfm_name, 0,
 						 CRYPTO_ALG_NEED_FALLBACK);
 		if (IS_ERR(fallback)) {
-			dev_err(ctx->jrdev, "Failed to allocate %s fallback: %ld\n",
-				tfm_name, PTR_ERR(fallback));
+			pr_err("Failed to allocate %s fallback: %ld\n",
+			       tfm_name, PTR_ERR(fallback));
 			return PTR_ERR(fallback);
 		}
 
diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c
index 98c1ff1744bb..a780e627838a 100644
--- a/drivers/crypto/caam/caamalg_qi2.c
+++ b/drivers/crypto/caam/caamalg_qi2.c
@@ -1611,7 +1611,8 @@ static int caam_cra_init_skcipher(struct crypto_skcipher *tfm)
 		fallback = crypto_alloc_skcipher(tfm_name, 0,
 						 CRYPTO_ALG_NEED_FALLBACK);
 		if (IS_ERR(fallback)) {
-			dev_err(ctx->dev, "Failed to allocate %s fallback: %ld\n",
+			dev_err(caam_alg->caam.dev,
+				"Failed to allocate %s fallback: %ld\n",
 				tfm_name, PTR_ERR(fallback));
 			return PTR_ERR(fallback);
 		}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: caam - fix printing on xts fallback allocation error path
  2020-11-01 20:05 [PATCH] crypto: caam - fix printing on xts fallback allocation error path Horia Geantă
@ 2020-11-02 10:49 ` Iuliana Prodan
  2020-11-06  7:03 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Iuliana Prodan @ 2020-11-02 10:49 UTC (permalink / raw)
  To: Horia Geantă, Herbert Xu, David S. Miller, Aymen Sghaier
  Cc: Andrei Botila, linux-crypto, dl-linux-imx, linux-kernel

On 11/1/2020 10:05 PM, Horia Geantă wrote:
> At the time xts fallback tfm allocation fails the device struct
> hasn't been enabled yet in the caam xts tfm's private context.
> 
> Fix this by using the device struct from xts algorithm's private context
> or, when not available, by replacing dev_err with pr_err.
> 
> Fixes: 9d9b14dbe077 ("crypto: caam/jr - add fallback for XTS with more than 8B IV")
> Fixes: 83e8aa912138 ("crypto: caam/qi - add fallback for XTS with more than 8B IV")
> Fixes: 36e2d7cfdcf1 ("crypto: caam/qi2 - add fallback for XTS with more than 8B IV")
> Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>

> ---
>   drivers/crypto/caam/caamalg.c     | 4 ++--
>   drivers/crypto/caam/caamalg_qi.c  | 4 ++--
>   drivers/crypto/caam/caamalg_qi2.c | 3 ++-
>   3 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
> index cf5bd7666dfc..8697ae53b063 100644
> --- a/drivers/crypto/caam/caamalg.c
> +++ b/drivers/crypto/caam/caamalg.c
> @@ -3404,8 +3404,8 @@ static int caam_cra_init(struct crypto_skcipher *tfm)
>   		fallback = crypto_alloc_skcipher(tfm_name, 0,
>   						 CRYPTO_ALG_NEED_FALLBACK);
>   		if (IS_ERR(fallback)) {
> -			dev_err(ctx->jrdev, "Failed to allocate %s fallback: %ld\n",
> -				tfm_name, PTR_ERR(fallback));
> +			pr_err("Failed to allocate %s fallback: %ld\n",
> +			       tfm_name, PTR_ERR(fallback));
>   			return PTR_ERR(fallback);
>   		}
>   
> diff --git a/drivers/crypto/caam/caamalg_qi.c b/drivers/crypto/caam/caamalg_qi.c
> index 66f60d78bdc8..a24ae966df4a 100644
> --- a/drivers/crypto/caam/caamalg_qi.c
> +++ b/drivers/crypto/caam/caamalg_qi.c
> @@ -2502,8 +2502,8 @@ static int caam_cra_init(struct crypto_skcipher *tfm)
>   		fallback = crypto_alloc_skcipher(tfm_name, 0,
>   						 CRYPTO_ALG_NEED_FALLBACK);
>   		if (IS_ERR(fallback)) {
> -			dev_err(ctx->jrdev, "Failed to allocate %s fallback: %ld\n",
> -				tfm_name, PTR_ERR(fallback));
> +			pr_err("Failed to allocate %s fallback: %ld\n",
> +			       tfm_name, PTR_ERR(fallback));
>   			return PTR_ERR(fallback);
>   		}
>   
> diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c
> index 98c1ff1744bb..a780e627838a 100644
> --- a/drivers/crypto/caam/caamalg_qi2.c
> +++ b/drivers/crypto/caam/caamalg_qi2.c
> @@ -1611,7 +1611,8 @@ static int caam_cra_init_skcipher(struct crypto_skcipher *tfm)
>   		fallback = crypto_alloc_skcipher(tfm_name, 0,
>   						 CRYPTO_ALG_NEED_FALLBACK);
>   		if (IS_ERR(fallback)) {
> -			dev_err(ctx->dev, "Failed to allocate %s fallback: %ld\n",
> +			dev_err(caam_alg->caam.dev,
> +				"Failed to allocate %s fallback: %ld\n",
>   				tfm_name, PTR_ERR(fallback));
>   			return PTR_ERR(fallback);
>   		}
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: caam - fix printing on xts fallback allocation error path
  2020-11-01 20:05 [PATCH] crypto: caam - fix printing on xts fallback allocation error path Horia Geantă
  2020-11-02 10:49 ` Iuliana Prodan
@ 2020-11-06  7:03 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2020-11-06  7:03 UTC (permalink / raw)
  To: Horia Geantă
  Cc: David S. Miller, Aymen Sghaier, Andrei Botila, linux-crypto,
	NXP Linux Team, linux-kernel

On Sun, Nov 01, 2020 at 10:05:53PM +0200, Horia Geantă wrote:
> At the time xts fallback tfm allocation fails the device struct
> hasn't been enabled yet in the caam xts tfm's private context.
> 
> Fix this by using the device struct from xts algorithm's private context
> or, when not available, by replacing dev_err with pr_err.
> 
> Fixes: 9d9b14dbe077 ("crypto: caam/jr - add fallback for XTS with more than 8B IV")
> Fixes: 83e8aa912138 ("crypto: caam/qi - add fallback for XTS with more than 8B IV")
> Fixes: 36e2d7cfdcf1 ("crypto: caam/qi2 - add fallback for XTS with more than 8B IV")
> Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
> ---
>  drivers/crypto/caam/caamalg.c     | 4 ++--
>  drivers/crypto/caam/caamalg_qi.c  | 4 ++--
>  drivers/crypto/caam/caamalg_qi2.c | 3 ++-
>  3 files changed, 6 insertions(+), 5 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-06  7:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-01 20:05 [PATCH] crypto: caam - fix printing on xts fallback allocation error path Horia Geantă
2020-11-02 10:49 ` Iuliana Prodan
2020-11-06  7:03 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).