2019-01-31 07:18:08

by Pankaj Gupta

[permalink] [raw]
Subject: [PATCH] fixed caam driver handling of sg list.

when the source sg contains more than 1 fragment and
destination sg contains 1 fragment, the caam driver
mishandle the buffers to be sent to caam.

Signed-off-by: Pankaj Gupta <[email protected]>
Signed-off-by: Arun Pathak <[email protected]>
---
drivers/crypto/caam/caamalg.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
index 2ec6e8cbf026..49f436230fb8 100644
--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -1056,6 +1056,7 @@ static void init_aead_job(struct aead_request *req,
if (unlikely(req->src != req->dst)) {
if (edesc->dst_nents == 1) {
dst_dma = sg_dma_address(req->dst);
+ out_options = 0;
} else {
dst_dma = edesc->sec4_sg_dma +
sec4_sg_index *
--
2.17.1



2019-01-31 09:38:01

by Horia Geanta

[permalink] [raw]
Subject: Re: [PATCH] fixed caam driver handling of sg list.

Thanks Pankaj.

On 1/31/2019 9:18 AM, Pankaj Gupta wrote:
> when the source sg contains more than 1 fragment and
> destination sg contains 1 fragment, the caam driver
> mishandle the buffers to be sent to caam.
>
Patch subject prefix should be: "crypto: caam -"

Please Cc stable by adding:
Cc: <[email protected]> # 4.3+

The root cause is commit:
f2147b88b2b1 ("crypto: caam - Convert GCM to new AEAD interface")

however the issue was not visible until the switch to new AEAD interface
completed, in commit:
479bcc7c5b9e ("crypto: caam - Convert authenc to new AEAD interface")

Thus it's probably correct to also add
Fixes: 479bcc7c5b9e ("crypto: caam - Convert authenc to new AEAD interface")

Horia

P.S. You are supposed to add driver maintainers in the loop, see MAINTAINERS
file and the handy scripts/get_maintainer.pl.

2019-01-31 11:21:03

by Horia Geanta

[permalink] [raw]
Subject: Re: [PATCH] fixed caam driver handling of sg list.

On 1/31/2019 11:38 AM, Horia Geanta wrote:
> Thanks Pankaj.
>
> On 1/31/2019 9:18 AM, Pankaj Gupta wrote:
>> when the source sg contains more than 1 fragment and
>> destination sg contains 1 fragment, the caam driver
>> mishandle the buffers to be sent to caam.
>>
> Patch subject prefix should be: "crypto: caam -"
>
> Please Cc stable by adding:
> Cc: <[email protected]> # 4.3+
>
> The root cause is commit:
> f2147b88b2b1 ("crypto: caam - Convert GCM to new AEAD interface")
>
> however the issue was not visible until the switch to new AEAD interface
> completed, in commit:
> 479bcc7c5b9e ("crypto: caam - Convert authenc to new AEAD interface")
>
> Thus it's probably correct to also add
> Fixes: 479bcc7c5b9e ("crypto: caam - Convert authenc to new AEAD interface")
>
Actually for gcm the issue should show up from the very beginning, so
Fixes: f2147b88b2b1 ("crypto: caam - Convert GCM to new AEAD interface")
Cc: <[email protected]> # 4.2+
is better.

Thanks,
Horia

2019-02-01 05:50:12

by Pankaj Gupta

[permalink] [raw]
Subject: [PATCHv2] crypto: caam - fixed handling of sg list

when the source sg contains more than 1 fragment and
destination sg contains 1 fragment, the caam driver
mishandle the buffers to be sent to caam.

Fixes: f2147b88b2b1 ("crypto: caam - Convert GCM to new AEAD interface")
Cc: <[email protected]> # 4.2+
Signed-off-by: Pankaj Gupta <[email protected]>
Signed-off-by: Arun Pathak <[email protected]>
---
drivers/crypto/caam/caamalg.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
index 2ec6e8cbf026..49f436230fb8 100644
--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -1056,6 +1056,7 @@ static void init_aead_job(struct aead_request *req,
if (unlikely(req->src != req->dst)) {
if (edesc->dst_nents == 1) {
dst_dma = sg_dma_address(req->dst);
+ out_options = 0;
} else {
dst_dma = edesc->sec4_sg_dma +
sec4_sg_index *
--
2.17.1


2019-02-01 06:51:50

by Horia Geanta

[permalink] [raw]
Subject: Re: [PATCHv2] crypto: caam - fixed handling of sg list

On 2/1/2019 7:50 AM, Pankaj Gupta wrote:
> when the source sg contains more than 1 fragment and
> destination sg contains 1 fragment, the caam driver
> mishandle the buffers to be sent to caam.
>
> Fixes: f2147b88b2b1 ("crypto: caam - Convert GCM to new AEAD interface")
> Cc: <[email protected]> # 4.2+
> Signed-off-by: Pankaj Gupta <[email protected]>
> Signed-off-by: Arun Pathak <[email protected]>
Reviewed-by: Horia Geant? <[email protected]>

Thanks,
Horia

2019-02-01 07:18:25

by Pankaj Gupta

[permalink] [raw]
Subject: [PATCH v3] crypto: caam - fixed handling of sg list

when the source sg contains more than 1 fragment and
destination sg contains 1 fragment, the caam driver
mishandle the buffers to be sent to caam.

Fixes: f2147b88b2b1 ("crypto: caam - Convert GCM to new AEAD interface")
Cc: <[email protected]> # 4.2+
Signed-off-by: Pankaj Gupta <[email protected]>
Signed-off-by: Arun Pathak <[email protected]>
Reviewed-by: Horia Geanta <[email protected]>
---
drivers/crypto/caam/caamalg.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
index 2ec6e8cbf026..49f436230fb8 100644
--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -1056,6 +1056,7 @@ static void init_aead_job(struct aead_request *req,
if (unlikely(req->src != req->dst)) {
if (edesc->dst_nents == 1) {
dst_dma = sg_dma_address(req->dst);
+ out_options = 0;
} else {
dst_dma = edesc->sec4_sg_dma +
sec4_sg_index *
--
2.17.1


2019-02-08 07:47:30

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH v3] crypto: caam - fixed handling of sg list

On Fri, Feb 01, 2019 at 07:18:20AM +0000, Pankaj Gupta wrote:
> when the source sg contains more than 1 fragment and
> destination sg contains 1 fragment, the caam driver
> mishandle the buffers to be sent to caam.
>
> Fixes: f2147b88b2b1 ("crypto: caam - Convert GCM to new AEAD interface")
> Cc: <[email protected]> # 4.2+
> Signed-off-by: Pankaj Gupta <[email protected]>
> Signed-off-by: Arun Pathak <[email protected]>
> Reviewed-by: Horia Geanta <[email protected]>
> ---
> drivers/crypto/caam/caamalg.c | 1 +
> 1 file changed, 1 insertion(+)

Patch applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt