mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rajan Vaja <rajan.vaja@xilinx.com>
To: herbert@gondor.apana.org.au, davem@davemloft.net,
	gregkh@linuxfoundation.org, kalyani.akula@xilinx.com
Cc: michal.simek@xilinx.com, jolly.shah@xilinx.com,
	linux-crypto@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Rajan Vaja <rajan.vaja@xilinx.com>
Subject: [PATCH char-misc-next] crypto: xilinx: Handle AES PM API return status
Date: Fri,  1 May 2020 03:14:51 -0700	[thread overview]
Message-ID: <1588328091-16368-1-git-send-email-rajan.vaja@xilinx.com> (raw)

Fixes: bc86f9c54616 ("firmware: xilinx: Remove eemi ops for aes engine")

Return value of AES PM API is not handled which may result in
unexpected value of "status" in zynqmp_pm_aes_engine().

Consider "status" value as valid only if AES PM API is successful.

Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
---
 drivers/crypto/xilinx/zynqmp-aes-gcm.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/xilinx/zynqmp-aes-gcm.c b/drivers/crypto/xilinx/zynqmp-aes-gcm.c
index d0a0daf..a27e3550 100644
--- a/drivers/crypto/xilinx/zynqmp-aes-gcm.c
+++ b/drivers/crypto/xilinx/zynqmp-aes-gcm.c
@@ -85,6 +85,7 @@ static int zynqmp_aes_aead_cipher(struct aead_request *req)
 	dma_addr_t dma_addr_data, dma_addr_hw_req;
 	unsigned int data_size;
 	unsigned int status;
+	int ret;
 	size_t dma_size;
 	char *kbuf;
 	int err;
@@ -132,9 +133,12 @@ static int zynqmp_aes_aead_cipher(struct aead_request *req)
 		hwreq->key = 0;
 	}
 
-	zynqmp_pm_aes_engine(dma_addr_hw_req, &status);
+	ret = zynqmp_pm_aes_engine(dma_addr_hw_req, &status);
 
-	if (status) {
+	if (ret) {
+		dev_err(dev, "ERROR: AES PM API failed\n");
+		err = ret;
+	} else if (status) {
 		switch (status) {
 		case ZYNQMP_AES_GCM_TAG_MISMATCH_ERR:
 			dev_err(dev, "ERROR: Gcm Tag mismatch\n");
-- 
2.7.4


             reply	other threads:[~2020-05-01 10:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01 10:14 Rajan Vaja [this message]
2020-05-01 10:30 ` Greg KH
2020-05-01 10:54   ` Rajan Vaja
2020-05-01 10:52 ` [PATCH char-misc-next v2] " Rajan Vaja

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=1588328091-16368-1-git-send-email-rajan.vaja@xilinx.com \
    --to=rajan.vaja@xilinx.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=jolly.shah@xilinx.com \
    --cc=kalyani.akula@xilinx.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®