diff mbox series

[char-misc-next] crypto: xilinx: Handle AES PM API return status

Message ID 1588328091-16368-1-git-send-email-rajan.vaja@xilinx.com (mailing list archive)
State Mainlined
Commit 1d9000262b3b80ef6675f35808856073e51be807
Headers show
Series [char-misc-next] crypto: xilinx: Handle AES PM API return status | expand

Commit Message

Rajan Vaja May 1, 2020, 10:14 a.m. UTC
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(-)

Comments

Greg Kroah-Hartman May 1, 2020, 10:30 a.m. UTC | #1
On Fri, May 01, 2020 at 03:14:51AM -0700, Rajan Vaja wrote:
> 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>

No "Reported-by:" line?

And put the "Fixes:" line down in the s-o-b area please.

thanks,

greg k-h
Rajan Vaja May 1, 2020, 10:54 a.m. UTC | #2
Thanks Gerg for review.

I have updated reported by and fixes tag properly now. Sent v2.

Thanks
Rajan

> -----Original Message-----
> From: Greg KH <gregkh@linuxfoundation.org>
> Sent: Friday, May 1, 2020 4:00 PM
> To: Rajan Vaja <RAJANV@xilinx.com>
> Cc: herbert@gondor.apana.org.au; davem@davemloft.net; Kalyani Akula
> <kalyania@xilinx.com>; Michal Simek <michals@xilinx.com>; Jolly Shah
> <JOLLYS@xilinx.com>; linux-crypto@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH char-misc-next] crypto: xilinx: Handle AES PM API return
> status
> 
> CAUTION: This message has originated from an External Source. Please use
> proper judgment and caution when opening attachments, clicking links, or
> responding to this email.
> 
> 
> On Fri, May 01, 2020 at 03:14:51AM -0700, Rajan Vaja wrote:
> > 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>
> 
> No "Reported-by:" line?
> 
> And put the "Fixes:" line down in the s-o-b area please.
> 
> thanks,
> 
> greg k-h
diff mbox series

Patch

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");