Skip to contentSkip to conversation

crypto: sm2 - fix a memory leak in sm2

PATCH Herbert Xu 2 participants 2 messages Jun 3, 2021 – Jun 4, 2021 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Herbert Xu

author maintainer
#1 lore raw
Quoted 8 lines · Hongbo Li

From: Hongbo Li <[email protected]>

SM2 module alloc ec->Q in sm2_set_pub_key(), when doing alg test in test_akcipher_one(), it will set public key for every test vector, and don't free ec->Q. This will cause a memory leak.

This patch alloc ec->Q in sm2_ec_ctx_init().

Quoted 7 lines
Fixes ea7ecb66440b ("crypto: sm2 - introduce OSCCA SM2 asymmetric cipher algorithm")
Cc [email protected] # v5.10+
---
 crypto/sm2.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

Your patch has been discarded by patchwork because you didn't update the Subject. The usual method is to use a version prefix such as v2, v3, etc. so that the Subject remains distinct.

Please resubmit with a new Subject.

Oh and don't cc [email protected].

Thanks,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#2 lore raw

Thank you for your review, I will resend this patch. Regards,
Hongbo

Quoted 31 lines · Herbert Xu <[email protected]> 于2021年6月3日周四 下午8:34写道:
Quoted 8 lines · Hongbo Li

From: Hongbo Li <[email protected]>

SM2 module alloc ec->Q in sm2_set_pub_key(), when doing alg test in test_akcipher_one(), it will set public key for every test vector, and don't free ec->Q. This will cause a memory leak.

This patch alloc ec->Q in sm2_ec_ctx_init().

Quoted 7 lines
Fixes ea7ecb66440b ("crypto: sm2 - introduce OSCCA SM2 asymmetric cipher algorithm")
Cc [email protected] # v5.10+
---
 crypto/sm2.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

Your patch has been discarded by patchwork because you didn't update the Subject. The usual method is to use a version prefix such as v2, v3, etc. so that the Subject remains distinct.

Please resubmit with a new Subject.

Oh and don't cc [email protected].

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