* [PATCH] s390/crypto: fix scatterwalk_unmap() callers in AES-GCM
@ 2022-05-17 14:30 Jann Horn
2022-05-17 18:01 ` Heiko Carstens
2022-05-18 11:19 ` Heiko Carstens
0 siblings, 2 replies; 5+ messages in thread
From: Jann Horn @ 2022-05-17 14:30 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
Cc: Herbert Xu, David S. Miller, linux-crypto, Christian Borntraeger,
Sven Schnelle, linux-s390, linux-kernel
The argument of scatterwalk_unmap() is supposed to be the void* that was
returned by the previous scatterwalk_map() call.
The s390 AES-GCM implementation was instead passing the pointer to the
struct scatter_walk.
This doesn't actually break anything because scatterwalk_unmap() only uses
its argument under CONFIG_HIGHMEM and ARCH_HAS_FLUSH_ON_KUNMAP.
Note that I have not tested this patch in any way, not even compile-tested
it.
Fixes: bf7fa038707c ("s390/crypto: add s390 platform specific aes gcm support.")
Signed-off-by: Jann Horn <jannh@google.com>
---
IDK which tree this has to go through - s390 or crypto?
maybe s390 is better, since they can actually test it?
arch/s390/crypto/aes_s390.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
index 54c7536f2482..1023e9d43d44 100644
--- a/arch/s390/crypto/aes_s390.c
+++ b/arch/s390/crypto/aes_s390.c
@@ -701,7 +701,7 @@ static inline void _gcm_sg_unmap_and_advance(struct gcm_sg_walk *gw,
unsigned int nbytes)
{
gw->walk_bytes_remain -= nbytes;
- scatterwalk_unmap(&gw->walk);
+ scatterwalk_unmap(gw->walk_ptr);
scatterwalk_advance(&gw->walk, nbytes);
scatterwalk_done(&gw->walk, 0, gw->walk_bytes_remain);
gw->walk_ptr = NULL;
@@ -776,7 +776,7 @@ static int gcm_out_walk_go(struct gcm_sg_walk *gw, unsigned int minbytesneeded)
goto out;
}
- scatterwalk_unmap(&gw->walk);
+ scatterwalk_unmap(gw->walk_ptr);
gw->walk_ptr = NULL;
gw->ptr = gw->buf;
base-commit: 42226c989789d8da4af1de0c31070c96726d990c
--
2.36.0.550.gb090851708-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] s390/crypto: fix scatterwalk_unmap() callers in AES-GCM
2022-05-17 14:30 [PATCH] s390/crypto: fix scatterwalk_unmap() callers in AES-GCM Jann Horn
@ 2022-05-17 18:01 ` Heiko Carstens
2022-05-18 6:50 ` Harald Freudenberger
2022-05-18 8:30 ` Harald Freudenberger
2022-05-18 11:19 ` Heiko Carstens
1 sibling, 2 replies; 5+ messages in thread
From: Heiko Carstens @ 2022-05-17 18:01 UTC (permalink / raw)
To: Jann Horn, Harald Freudenberger
Cc: Vasily Gorbik, Alexander Gordeev, Herbert Xu, David S. Miller,
linux-crypto, Christian Borntraeger, Sven Schnelle, linux-s390,
linux-kernel
On Tue, May 17, 2022 at 04:30:47PM +0200, Jann Horn wrote:
> The argument of scatterwalk_unmap() is supposed to be the void* that was
> returned by the previous scatterwalk_map() call.
> The s390 AES-GCM implementation was instead passing the pointer to the
> struct scatter_walk.
>
> This doesn't actually break anything because scatterwalk_unmap() only uses
> its argument under CONFIG_HIGHMEM and ARCH_HAS_FLUSH_ON_KUNMAP.
>
> Note that I have not tested this patch in any way, not even compile-tested
> it.
>
> Fixes: bf7fa038707c ("s390/crypto: add s390 platform specific aes gcm support.")
> Signed-off-by: Jann Horn <jannh@google.com>
> ---
> IDK which tree this has to go through - s390 or crypto?
> maybe s390 is better, since they can actually test it?
>
> arch/s390/crypto/aes_s390.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
This can go via the s390 tree, however I'd like to have an ACK from
Harald, who wrote the original code.
> diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
> index 54c7536f2482..1023e9d43d44 100644
> --- a/arch/s390/crypto/aes_s390.c
> +++ b/arch/s390/crypto/aes_s390.c
> @@ -701,7 +701,7 @@ static inline void _gcm_sg_unmap_and_advance(struct gcm_sg_walk *gw,
> unsigned int nbytes)
> {
> gw->walk_bytes_remain -= nbytes;
> - scatterwalk_unmap(&gw->walk);
> + scatterwalk_unmap(gw->walk_ptr);
> scatterwalk_advance(&gw->walk, nbytes);
> scatterwalk_done(&gw->walk, 0, gw->walk_bytes_remain);
> gw->walk_ptr = NULL;
> @@ -776,7 +776,7 @@ static int gcm_out_walk_go(struct gcm_sg_walk *gw, unsigned int minbytesneeded)
> goto out;
> }
>
> - scatterwalk_unmap(&gw->walk);
> + scatterwalk_unmap(gw->walk_ptr);
> gw->walk_ptr = NULL;
>
> gw->ptr = gw->buf;
>
> base-commit: 42226c989789d8da4af1de0c31070c96726d990c
> --
> 2.36.0.550.gb090851708-goog
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] s390/crypto: fix scatterwalk_unmap() callers in AES-GCM
2022-05-17 18:01 ` Heiko Carstens
@ 2022-05-18 6:50 ` Harald Freudenberger
2022-05-18 8:30 ` Harald Freudenberger
1 sibling, 0 replies; 5+ messages in thread
From: Harald Freudenberger @ 2022-05-18 6:50 UTC (permalink / raw)
On 2022-05-17 20:01, Heiko Carstens wrote:
> On Tue, May 17, 2022 at 04:30:47PM +0200, Jann Horn wrote:
>> The argument of scatterwalk_unmap() is supposed to be the void* that
>> was
>> returned by the previous scatterwalk_map() call.
>> The s390 AES-GCM implementation was instead passing the pointer to the
>> struct scatter_walk.
>>
>> This doesn't actually break anything because scatterwalk_unmap() only
>> uses
>> its argument under CONFIG_HIGHMEM and ARCH_HAS_FLUSH_ON_KUNMAP.
>>
>> Note that I have not tested this patch in any way, not even
>> compile-tested
>> it.
>>
>> Fixes: bf7fa038707c ("s390/crypto: add s390 platform specific aes gcm
>> support.")
>> Signed-off-by: Jann Horn <jannh@google.com>
>> ---
>> IDK which tree this has to go through - s390 or crypto?
>> maybe s390 is better, since they can actually test it?
>>
>> arch/s390/crypto/aes_s390.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> This can go via the s390 tree, however I'd like to have an ACK from
> Harald, who wrote the original code.
>
>> diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
>> index 54c7536f2482..1023e9d43d44 100644
>> --- a/arch/s390/crypto/aes_s390.c
>> +++ b/arch/s390/crypto/aes_s390.c
>> @@ -701,7 +701,7 @@ static inline void
>> _gcm_sg_unmap_and_advance(struct gcm_sg_walk *gw,
>> unsigned int nbytes)
>> {
>> gw->walk_bytes_remain -= nbytes;
>> - scatterwalk_unmap(&gw->walk);
>> + scatterwalk_unmap(gw->walk_ptr);
>> scatterwalk_advance(&gw->walk, nbytes);
>> scatterwalk_done(&gw->walk, 0, gw->walk_bytes_remain);
>> gw->walk_ptr = NULL;
>> @@ -776,7 +776,7 @@ static int gcm_out_walk_go(struct gcm_sg_walk *gw,
>> unsigned int minbytesneeded)
>> goto out;
>> }
>>
>> - scatterwalk_unmap(&gw->walk);
>> + scatterwalk_unmap(gw->walk_ptr);
>> gw->walk_ptr = NULL;
>>
>> gw->ptr = gw->buf;
>>
>> base-commit: 42226c989789d8da4af1de0c31070c96726d990c
>> --
>> 2.36.0.550.gb090851708-goog
>>
Give me a chance to test this and when the testcases all pass, I'll give
a green light....
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] s390/crypto: fix scatterwalk_unmap() callers in AES-GCM
2022-05-17 18:01 ` Heiko Carstens
2022-05-18 6:50 ` Harald Freudenberger
@ 2022-05-18 8:30 ` Harald Freudenberger
1 sibling, 0 replies; 5+ messages in thread
From: Harald Freudenberger @ 2022-05-18 8:30 UTC (permalink / raw)
On 2022-05-17 20:01, Heiko Carstens wrote:
> On Tue, May 17, 2022 at 04:30:47PM +0200, Jann Horn wrote:
>> The argument of scatterwalk_unmap() is supposed to be the void* that
>> was
>> returned by the previous scatterwalk_map() call.
>> The s390 AES-GCM implementation was instead passing the pointer to the
>> struct scatter_walk.
>>
>> This doesn't actually break anything because scatterwalk_unmap() only
>> uses
>> its argument under CONFIG_HIGHMEM and ARCH_HAS_FLUSH_ON_KUNMAP.
>>
>> Note that I have not tested this patch in any way, not even
>> compile-tested
>> it.
>>
>> Fixes: bf7fa038707c ("s390/crypto: add s390 platform specific aes gcm
>> support.")
>> Signed-off-by: Jann Horn <jannh@google.com>
>> ---
>> IDK which tree this has to go through - s390 or crypto?
>> maybe s390 is better, since they can actually test it?
>>
>> arch/s390/crypto/aes_s390.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> This can go via the s390 tree, however I'd like to have an ACK from
> Harald, who wrote the original code.
>
>> diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
>> index 54c7536f2482..1023e9d43d44 100644
>> --- a/arch/s390/crypto/aes_s390.c
>> +++ b/arch/s390/crypto/aes_s390.c
>> @@ -701,7 +701,7 @@ static inline void
>> _gcm_sg_unmap_and_advance(struct gcm_sg_walk *gw,
>> unsigned int nbytes)
>> {
>> gw->walk_bytes_remain -= nbytes;
>> - scatterwalk_unmap(&gw->walk);
>> + scatterwalk_unmap(gw->walk_ptr);
>> scatterwalk_advance(&gw->walk, nbytes);
>> scatterwalk_done(&gw->walk, 0, gw->walk_bytes_remain);
>> gw->walk_ptr = NULL;
>> @@ -776,7 +776,7 @@ static int gcm_out_walk_go(struct gcm_sg_walk *gw,
>> unsigned int minbytesneeded)
>> goto out;
>> }
>>
>> - scatterwalk_unmap(&gw->walk);
>> + scatterwalk_unmap(gw->walk_ptr);
>> gw->walk_ptr = NULL;
>>
>> gw->ptr = gw->buf;
>>
>> base-commit: 42226c989789d8da4af1de0c31070c96726d990c
>> --
>> 2.36.0.550.gb090851708-goog
>>
Ok, tests pass. Here is my Acked-by: Harald Freudenberger
<freude@linux.ibm.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] s390/crypto: fix scatterwalk_unmap() callers in AES-GCM
2022-05-17 14:30 [PATCH] s390/crypto: fix scatterwalk_unmap() callers in AES-GCM Jann Horn
2022-05-17 18:01 ` Heiko Carstens
@ 2022-05-18 11:19 ` Heiko Carstens
1 sibling, 0 replies; 5+ messages in thread
From: Heiko Carstens @ 2022-05-18 11:19 UTC (permalink / raw)
To: Jann Horn, Harald Freudenberger
Cc: Vasily Gorbik, Alexander Gordeev, Herbert Xu, David S. Miller,
linux-crypto, Christian Borntraeger, Sven Schnelle, linux-s390,
linux-kernel
On Tue, May 17, 2022 at 04:30:47PM +0200, Jann Horn wrote:
> The argument of scatterwalk_unmap() is supposed to be the void* that was
> returned by the previous scatterwalk_map() call.
> The s390 AES-GCM implementation was instead passing the pointer to the
> struct scatter_walk.
>
> This doesn't actually break anything because scatterwalk_unmap() only uses
> its argument under CONFIG_HIGHMEM and ARCH_HAS_FLUSH_ON_KUNMAP.
>
> Note that I have not tested this patch in any way, not even compile-tested
> it.
>
> Fixes: bf7fa038707c ("s390/crypto: add s390 platform specific aes gcm support.")
> Signed-off-by: Jann Horn <jannh@google.com>
> ---
> IDK which tree this has to go through - s390 or crypto?
> maybe s390 is better, since they can actually test it?
Applied to s390 tree. Thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-05-18 11:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-17 14:30 [PATCH] s390/crypto: fix scatterwalk_unmap() callers in AES-GCM Jann Horn
2022-05-17 18:01 ` Heiko Carstens
2022-05-18 6:50 ` Harald Freudenberger
2022-05-18 8:30 ` Harald Freudenberger
2022-05-18 11:19 ` Heiko Carstens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).