All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shijith Thotton <sthotton@marvell.com>
To: Arnaud Ebalard <arno@natisbad.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Boris Brezillon <bbrezillon@kernel.org>
Cc: Shijith Thotton <sthotton@marvell.com>,
	<linux-crypto@vger.kernel.org>, <jerinj@marvell.com>,
	<sgoutham@marvell.com>, <anoobj@marvell.com>,
	"Srujana Challa" <schalla@marvell.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Ovidiu Panait" <ovidiu.panait@windriver.com>,
	chiminghao <chi.minghao@zte.com.cn>,
	Suheil Chandran <schandran@marvell.com>,
	Lukasz Bartosik <lbartosik@marvell.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: [PATCH v3] crypto: octeontx2: remove CONFIG_DM_CRYPT check
Date: Fri, 28 Jan 2022 19:27:42 +0530	[thread overview]
Message-ID: <2ea465e8bde7f4d03757ae398d38f62a350dd28c.1643378034.git.sthotton@marvell.com> (raw)
In-Reply-To: <3ef09bf0c4adf7bc33f01f60cb8ce96e8f77b58c.1642786900.git.sthotton@marvell.com>

No issues were found while using the driver with dm-crypt enabled. So
CONFIG_DM_CRYPT check in the driver can be removed.

This also fixes the NULL pointer dereference in driver release if
CONFIG_DM_CRYPT is enabled.

...
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008
...
Call trace:
 crypto_unregister_alg+0x68/0xfc
 crypto_unregister_skciphers+0x44/0x60
 otx2_cpt_crypto_exit+0x100/0x1a0
 otx2_cptvf_remove+0xf8/0x200
 pci_device_remove+0x3c/0xd4
 __device_release_driver+0x188/0x234
 device_release_driver+0x2c/0x4c
...

Fixes: 6f03f0e8b6c8 ("crypto: octeontx2 - register with linux crypto framework")
Signed-off-by: Shijith Thotton <sthotton@marvell.com>
---
 .../crypto/marvell/octeontx2/otx2_cptvf_algs.c  | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c b/drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c
index 2748a3327e39..f8f8542ce3e4 100644
--- a/drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c
+++ b/drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c
@@ -1634,16 +1634,13 @@ static inline int cpt_register_algs(void)
 {
 	int i, err = 0;
 
-	if (!IS_ENABLED(CONFIG_DM_CRYPT)) {
-		for (i = 0; i < ARRAY_SIZE(otx2_cpt_skciphers); i++)
-			otx2_cpt_skciphers[i].base.cra_flags &=
-							~CRYPTO_ALG_DEAD;
-
-		err = crypto_register_skciphers(otx2_cpt_skciphers,
-						ARRAY_SIZE(otx2_cpt_skciphers));
-		if (err)
-			return err;
-	}
+	for (i = 0; i < ARRAY_SIZE(otx2_cpt_skciphers); i++)
+		otx2_cpt_skciphers[i].base.cra_flags &= ~CRYPTO_ALG_DEAD;
+
+	err = crypto_register_skciphers(otx2_cpt_skciphers,
+					ARRAY_SIZE(otx2_cpt_skciphers));
+	if (err)
+		return err;
 
 	for (i = 0; i < ARRAY_SIZE(otx2_cpt_aeads); i++)
 		otx2_cpt_aeads[i].base.cra_flags &= ~CRYPTO_ALG_DEAD;
-- 
2.25.1


  parent reply	other threads:[~2022-01-28 13:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21 14:03 [PATCH] crypto: octeontx2: fix NULL pointer dereference Shijith Thotton
2022-01-21 17:43 ` [PATCH v2] " Shijith Thotton
2022-01-28  5:43   ` Herbert Xu
2022-01-28 11:19     ` [EXT] " Shijith Thotton
2022-01-28 13:57   ` Shijith Thotton [this message]
2022-02-05  4:32     ` [PATCH v3] crypto: octeontx2: remove CONFIG_DM_CRYPT check Herbert Xu

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=2ea465e8bde7f4d03757ae398d38f62a350dd28c.1643378034.git.sthotton@marvell.com \
    --to=sthotton@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=arno@natisbad.org \
    --cc=bbrezillon@kernel.org \
    --cc=chi.minghao@zte.com.cn \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=jerinj@marvell.com \
    --cc=lbartosik@marvell.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ovidiu.panait@windriver.com \
    --cc=schalla@marvell.com \
    --cc=schandran@marvell.com \
    --cc=sgoutham@marvell.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.