2020-05-01 10:16:09

by Rajan Vaja

[permalink] [raw]
Subject: [PATCH char-misc-next] crypto: xilinx: Handle AES PM API return status

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 <[email protected]>
---
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


2020-05-01 10:30:57

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH char-misc-next] crypto: xilinx: Handle AES PM API return status

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 <[email protected]>

No "Reported-by:" line?

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

thanks,

greg k-h

2020-05-01 10:53:58

by Rajan Vaja

[permalink] [raw]
Subject: [PATCH char-misc-next v2] crypto: xilinx: Handle AES PM API return status

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.

Fixes: bc86f9c54616 ("firmware: xilinx: Remove eemi ops for aes engine")
Reported-by: Stephen Rothwell <[email protected]>
Signed-off-by: Rajan Vaja <[email protected]>
---
Changes in v2:
- Add fixes tag above s-o-b section
- Add reported-by
---
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

2020-05-01 10:57:17

by Rajan Vaja

[permalink] [raw]
Subject: RE: [PATCH char-misc-next] crypto: xilinx: Handle AES PM API return status

Thanks Gerg for review.

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

Thanks
Rajan

> -----Original Message-----
> From: Greg KH <[email protected]>
> Sent: Friday, May 1, 2020 4:00 PM
> To: Rajan Vaja <[email protected]>
> Cc: [email protected]au; [email protected]; Kalyani Akula
> <[email protected]>; Michal Simek <[email protected]>; Jolly Shah
> <[email protected]>; [email protected]; linux-arm-
> [email protected]; [email protected]
> 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 <[email protected]>
>
> No "Reported-by:" line?
>
> And put the "Fixes:" line down in the s-o-b area please.
>
> thanks,
>
> greg k-h