All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tero Kristo <t-kristo@ti.com>
To: <linux-omap@vger.kernel.org>, <linux-crypto@vger.kernel.org>,
	<herbert@gondor.apana.org.au>, <davem@davemloft.net>,
	<tony@atomide.com>
Cc: <linux-arm-kernel@lists.infradead.org>, <lokeshvutla@ti.com>,
	Tero Kristo <t-kristo@ti.com>
Subject: [PATCH 15/28] crypto: omap-des: fix crypto engine initialization order
Date: Wed, 1 Jun 2016 11:56:16 +0300	[thread overview]
Message-ID: <1464771389-10640-16-git-send-email-t-kristo@ti.com> (raw)
In-Reply-To: <1464771389-10640-1-git-send-email-t-kristo@ti.com>

The crypto engine must be initialized before registering algorithms,
otherwise the test manager will crash as it attempts to execute
tests for the algos while they are being registered.

Fixes: f1b77aaca85a ("crypto: omap-des - Integrate with the crypto engine framework")
Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 drivers/crypto/omap-des.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c
index e4c87bc..f5bf0d1 100644
--- a/drivers/crypto/omap-des.c
+++ b/drivers/crypto/omap-des.c
@@ -1079,6 +1079,17 @@ static int omap_des_probe(struct platform_device *pdev)
 	list_add_tail(&dd->list, &dev_list);
 	spin_unlock(&list_lock);
 
+	/* Initialize des crypto engine */
+	dd->engine = crypto_engine_alloc_init(dev, 1);
+	if (!dd->engine)
+		goto err_engine;
+
+	dd->engine->prepare_request = omap_des_prepare_req;
+	dd->engine->crypt_one_request = omap_des_crypt_req;
+	err = crypto_engine_start(dd->engine);
+	if (err)
+		goto err_engine;
+
 	for (i = 0; i < dd->pdata->algs_info_size; i++) {
 		for (j = 0; j < dd->pdata->algs_info[i].size; j++) {
 			algp = &dd->pdata->algs_info[i].algs_list[j];
@@ -1094,27 +1105,18 @@ static int omap_des_probe(struct platform_device *pdev)
 		}
 	}
 
-	/* Initialize des crypto engine */
-	dd->engine = crypto_engine_alloc_init(dev, 1);
-	if (!dd->engine)
-		goto err_algs;
-
-	dd->engine->prepare_request = omap_des_prepare_req;
-	dd->engine->crypt_one_request = omap_des_crypt_req;
-	err = crypto_engine_start(dd->engine);
-	if (err)
-		goto err_engine;
-
 	return 0;
 
-err_engine:
-	crypto_engine_exit(dd->engine);
 err_algs:
 	for (i = dd->pdata->algs_info_size - 1; i >= 0; i--)
 		for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--)
 			crypto_unregister_alg(
 					&dd->pdata->algs_info[i].algs_list[j]);
 
+err_engine:
+	if (dd->engine)
+		crypto_engine_exit(dd->engine);
+
 	omap_des_dma_cleanup(dd);
 err_irq:
 	tasklet_kill(&dd->done_task);
-- 
1.9.1

WARNING: multiple messages have this Message-ID (diff)
From: Tero Kristo <t-kristo@ti.com>
To: linux-omap@vger.kernel.org, linux-crypto@vger.kernel.org,
	herbert@gondor.apana.org.au, davem@davemloft.net,
	tony@atomide.com
Cc: linux-arm-kernel@lists.infradead.org, lokeshvutla@ti.com,
	Tero Kristo <t-kristo@ti.com>
Subject: [PATCH 15/28] crypto: omap-des: fix crypto engine initialization order
Date: Wed, 1 Jun 2016 11:56:16 +0300	[thread overview]
Message-ID: <1464771389-10640-16-git-send-email-t-kristo@ti.com> (raw)
In-Reply-To: <1464771389-10640-1-git-send-email-t-kristo@ti.com>

The crypto engine must be initialized before registering algorithms,
otherwise the test manager will crash as it attempts to execute
tests for the algos while they are being registered.

Fixes: f1b77aaca85a ("crypto: omap-des - Integrate with the crypto engine framework")
Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 drivers/crypto/omap-des.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c
index e4c87bc..f5bf0d1 100644
--- a/drivers/crypto/omap-des.c
+++ b/drivers/crypto/omap-des.c
@@ -1079,6 +1079,17 @@ static int omap_des_probe(struct platform_device *pdev)
 	list_add_tail(&dd->list, &dev_list);
 	spin_unlock(&list_lock);
 
+	/* Initialize des crypto engine */
+	dd->engine = crypto_engine_alloc_init(dev, 1);
+	if (!dd->engine)
+		goto err_engine;
+
+	dd->engine->prepare_request = omap_des_prepare_req;
+	dd->engine->crypt_one_request = omap_des_crypt_req;
+	err = crypto_engine_start(dd->engine);
+	if (err)
+		goto err_engine;
+
 	for (i = 0; i < dd->pdata->algs_info_size; i++) {
 		for (j = 0; j < dd->pdata->algs_info[i].size; j++) {
 			algp = &dd->pdata->algs_info[i].algs_list[j];
@@ -1094,27 +1105,18 @@ static int omap_des_probe(struct platform_device *pdev)
 		}
 	}
 
-	/* Initialize des crypto engine */
-	dd->engine = crypto_engine_alloc_init(dev, 1);
-	if (!dd->engine)
-		goto err_algs;
-
-	dd->engine->prepare_request = omap_des_prepare_req;
-	dd->engine->crypt_one_request = omap_des_crypt_req;
-	err = crypto_engine_start(dd->engine);
-	if (err)
-		goto err_engine;
-
 	return 0;
 
-err_engine:
-	crypto_engine_exit(dd->engine);
 err_algs:
 	for (i = dd->pdata->algs_info_size - 1; i >= 0; i--)
 		for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--)
 			crypto_unregister_alg(
 					&dd->pdata->algs_info[i].algs_list[j]);
 
+err_engine:
+	if (dd->engine)
+		crypto_engine_exit(dd->engine);
+
 	omap_des_dma_cleanup(dd);
 err_irq:
 	tasklet_kill(&dd->done_task);
-- 
1.9.1

WARNING: multiple messages have this Message-ID (diff)
From: t-kristo@ti.com (Tero Kristo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 15/28] crypto: omap-des: fix crypto engine initialization order
Date: Wed, 1 Jun 2016 11:56:16 +0300	[thread overview]
Message-ID: <1464771389-10640-16-git-send-email-t-kristo@ti.com> (raw)
In-Reply-To: <1464771389-10640-1-git-send-email-t-kristo@ti.com>

The crypto engine must be initialized before registering algorithms,
otherwise the test manager will crash as it attempts to execute
tests for the algos while they are being registered.

Fixes: f1b77aaca85a ("crypto: omap-des - Integrate with the crypto engine framework")
Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 drivers/crypto/omap-des.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c
index e4c87bc..f5bf0d1 100644
--- a/drivers/crypto/omap-des.c
+++ b/drivers/crypto/omap-des.c
@@ -1079,6 +1079,17 @@ static int omap_des_probe(struct platform_device *pdev)
 	list_add_tail(&dd->list, &dev_list);
 	spin_unlock(&list_lock);
 
+	/* Initialize des crypto engine */
+	dd->engine = crypto_engine_alloc_init(dev, 1);
+	if (!dd->engine)
+		goto err_engine;
+
+	dd->engine->prepare_request = omap_des_prepare_req;
+	dd->engine->crypt_one_request = omap_des_crypt_req;
+	err = crypto_engine_start(dd->engine);
+	if (err)
+		goto err_engine;
+
 	for (i = 0; i < dd->pdata->algs_info_size; i++) {
 		for (j = 0; j < dd->pdata->algs_info[i].size; j++) {
 			algp = &dd->pdata->algs_info[i].algs_list[j];
@@ -1094,27 +1105,18 @@ static int omap_des_probe(struct platform_device *pdev)
 		}
 	}
 
-	/* Initialize des crypto engine */
-	dd->engine = crypto_engine_alloc_init(dev, 1);
-	if (!dd->engine)
-		goto err_algs;
-
-	dd->engine->prepare_request = omap_des_prepare_req;
-	dd->engine->crypt_one_request = omap_des_crypt_req;
-	err = crypto_engine_start(dd->engine);
-	if (err)
-		goto err_engine;
-
 	return 0;
 
-err_engine:
-	crypto_engine_exit(dd->engine);
 err_algs:
 	for (i = dd->pdata->algs_info_size - 1; i >= 0; i--)
 		for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--)
 			crypto_unregister_alg(
 					&dd->pdata->algs_info[i].algs_list[j]);
 
+err_engine:
+	if (dd->engine)
+		crypto_engine_exit(dd->engine);
+
 	omap_des_dma_cleanup(dd);
 err_irq:
 	tasklet_kill(&dd->done_task);
-- 
1.9.1

  parent reply	other threads:[~2016-06-01  8:58 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-01  8:56 [PATCH 00/28] crypto: omap fixes / support additions Tero Kristo
2016-06-01  8:56 ` Tero Kristo
2016-06-01  8:56 ` Tero Kristo
2016-06-01  8:56 ` [PATCH 01/28] crypto: omap-aes: Fix registration of algorithms Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-07 10:48   ` Herbert Xu
2016-06-07 10:48     ` Herbert Xu
2016-06-20 12:11     ` Tero Kristo
2016-06-20 12:11       ` Tero Kristo
2016-06-20 23:49       ` Herbert Xu
2016-06-20 23:49         ` Herbert Xu
2016-06-01  8:56 ` [PATCH 02/28] crypto: omap-sham: Don't idle/start SHA device between Encrypt operations Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  9:53   ` Grygorii Strashko
2016-06-01  9:53     ` Grygorii Strashko
2016-06-01  9:53     ` Grygorii Strashko
2016-06-01 23:03     ` Dave Gerlach
2016-06-01 23:03       ` Dave Gerlach
2016-06-01 23:03       ` Dave Gerlach
2016-06-07 10:08       ` Herbert Xu
2016-06-07 10:08         ` Herbert Xu
2016-06-07 11:52         ` Tero Kristo
2016-06-07 11:52           ` Tero Kristo
2016-06-07 11:52           ` Tero Kristo
2016-06-07 12:24           ` Grygorii Strashko
2016-06-07 12:24             ` Grygorii Strashko
2016-06-07 12:24             ` Grygorii Strashko
2016-06-22  9:17             ` Tero Kristo
2016-06-22  9:17               ` Tero Kristo
2016-06-01  8:56 ` [PATCH 03/28] crypto: omap-sham: change queue size from 1 to 10 Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56 ` [PATCH 04/28] crypto: omap: do not call dmaengine_terminate_all Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56 ` [PATCH 05/28] crypto: omap-sham: set sw fallback to 240 bytes Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56 ` [PATCH 06/28] crypto: omap-sham: avoid executing tasklet where not needed Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56 ` [PATCH 07/28] crypto: ahash: increase the maximum allowed statesize Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56 ` [PATCH 08/28] crypto: omap-sham: implement context export/import APIs Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56 ` [PATCH 09/28] crypto: omap-des: Fix support for unequal lengths Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56 ` [PATCH 10/28] crypto: omap-aes - Fix enabling clocks Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56 ` [PATCH 11/28] crypto: omap-aes: Add support for multiple cores Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56 ` [PATCH 12/28] crypto: omap-aes: Add fallback support Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56 ` [PATCH 13/28] crypto: engine: avoid unnecessary context switches Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56 ` [PATCH 14/28] crypto: omap-aes: fix crypto engine initialization order Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  8:56 ` Tero Kristo [this message]
2016-06-01  8:56   ` [PATCH 15/28] crypto: omap-des: " Tero Kristo
2016-06-01  8:56   ` Tero Kristo
2016-06-01  9:04 ` [PATCH 16/28] ARM: DRA7: hwmod: Add data for DES IP Tero Kristo
2016-06-01  9:04   ` Tero Kristo
2016-06-01  9:04   ` Tero Kristo
2016-06-01  9:06 ` [PATCH 17/28] ARM: DRA7: hwmod: Add data for AES IP Tero Kristo
2016-06-01  9:06   ` Tero Kristo
2016-06-01  9:06   ` Tero Kristo
2016-06-01  9:06 ` [PATCH 18/28] ARM: DRA7: hwmod: Add data for SHA IP Tero Kristo
2016-06-01  9:06   ` Tero Kristo
2016-06-01  9:06   ` Tero Kristo
2016-06-01  9:06 ` [PATCH 20/28] ARM: OMAP: DRA7xx: Make L4SEC clock domain SWSUP only Tero Kristo
2016-06-01  9:06   ` Tero Kristo
2016-06-01  9:06   ` Tero Kristo
2016-06-01  9:06   ` [PATCH 21/28] ARM: AM43xx: hwmod: Add data for DES Tero Kristo
2016-06-01  9:06     ` Tero Kristo
2016-06-01  9:06     ` Tero Kristo
2016-06-01  9:06   ` [PATCH 22/28] ARM: AMx3xx: hwmod: Add data for RNG Tero Kristo
2016-06-01  9:06     ` Tero Kristo
2016-06-01  9:06     ` Tero Kristo
2016-06-01  9:06   ` [PATCH 23/28] ARM: dts: DRA7: Add DT node for DES IP Tero Kristo
2016-06-01  9:06     ` Tero Kristo
2016-06-01  9:06     ` Tero Kristo
2016-06-10 11:38     ` Tony Lindgren
2016-06-10 11:38       ` Tony Lindgren
2016-06-21 17:56       ` Tero Kristo
2016-06-21 17:56         ` Tero Kristo
2016-06-21 17:56         ` Tero Kristo
2016-06-22  7:58         ` Tony Lindgren
2016-06-22  7:58           ` Tony Lindgren
2016-06-01  9:06   ` [PATCH 24/28] ARM: dts: DRA7: Add DT nodes for AES IP Tero Kristo
2016-06-01  9:06     ` Tero Kristo
2016-06-01  9:06     ` Tero Kristo
2016-06-01  9:06   ` [PATCH 25/28] ARM: dts: DRA7: Add support for SHA IP Tero Kristo
2016-06-01  9:06     ` Tero Kristo
2016-06-01  9:06     ` Tero Kristo
2016-06-01  9:06   ` [PATCH 26/28] ARM: dts: DRA7: Add DT node for RNG IP Tero Kristo
2016-06-01  9:06     ` Tero Kristo
2016-06-01  9:06     ` Tero Kristo
2016-06-01  9:06   ` [PATCH 27/28] ARM: dts: AM43xx: clk: Add RNG clk node Tero Kristo
2016-06-01  9:06     ` Tero Kristo
2016-06-01  9:06     ` Tero Kristo
2016-06-01  9:06   ` [PATCH 28/28] ARM: dts: AM43xx: Add node for RNG Tero Kristo
2016-06-01  9:06     ` Tero Kristo
2016-06-01  9:06     ` Tero Kristo
2016-06-01  9:06 ` [PATCH 19/28] ARM: DRA7: hwmod: Add data for RNG IP Tero Kristo
2016-06-01  9:06   ` Tero Kristo
2016-06-01  9:06   ` Tero Kristo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464771389-10640-16-git-send-email-t-kristo@ti.com \
    --to=t-kristo@ti.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=lokeshvutla@ti.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.