From: Dinghao Liu <hidden> Date: 2021-01-09 11:34:54
When kmalloc() fails, tmp_tfm allocated by
crypto_alloc_shash() has not been freed, which
leads to memleak.
Fixes: d46eb3699502b ("evm: crypto hash replaced by shash")
Signed-off-by: Dinghao Liu <redacted>
---
security/integrity/evm/evm_crypto.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
From: Eric Biggers <ebiggers@kernel.org> Date: 2021-01-09 17:08:16
On Sat, Jan 09, 2021 at 07:33:05PM +0800, Dinghao Liu wrote:
quoted hunk
When kmalloc() fails, tmp_tfm allocated by
crypto_alloc_shash() has not been freed, which
leads to memleak.
Fixes: d46eb3699502b ("evm: crypto hash replaced by shash")
Signed-off-by: Dinghao Liu <redacted>
---
security/integrity/evm/evm_crypto.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
On Sat, Jan 09, 2021 at 07:33:05PM +0800, Dinghao Liu wrote:
quoted
When kmalloc() fails, tmp_tfm allocated by
crypto_alloc_shash() has not been freed, which
leads to memleak.
Fixes: d46eb3699502b ("evm: crypto hash replaced by shash")
Signed-off-by: Dinghao Liu <redacted>
---
security/integrity/evm/evm_crypto.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
There's no need to check for NULL before calling crypto_free_shash().
I find there is a crypto_shash_tfm() in the definition of
crypto_free_shash(). Will this lead to null pointer dereference
when we use it to free a NULL pointer?
Regards,
Dinghao
From: Eric Biggers <ebiggers@kernel.org> Date: 2021-01-10 06:54:42
On Sun, Jan 10, 2021 at 01:27:09PM +0800, dinghao.liu@zju.edu.cn wrote:
quoted
On Sat, Jan 09, 2021 at 07:33:05PM +0800, Dinghao Liu wrote:
quoted
When kmalloc() fails, tmp_tfm allocated by
crypto_alloc_shash() has not been freed, which
leads to memleak.
Fixes: d46eb3699502b ("evm: crypto hash replaced by shash")
Signed-off-by: Dinghao Liu <redacted>
---
security/integrity/evm/evm_crypto.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
There's no need to check for NULL before calling crypto_free_shash().
I find there is a crypto_shash_tfm() in the definition of
crypto_free_shash(). Will this lead to null pointer dereference
when we use it to free a NULL pointer?
On Sun, Jan 10, 2021 at 01:27:09PM +0800, dinghao.liu@zju.edu.cn wrote:
quoted
quoted
On Sat, Jan 09, 2021 at 07:33:05PM +0800, Dinghao Liu wrote:
quoted
When kmalloc() fails, tmp_tfm allocated by
crypto_alloc_shash() has not been freed, which
leads to memleak.
Fixes: d46eb3699502b ("evm: crypto hash replaced by shash")
Signed-off-by: Dinghao Liu <redacted>
---
security/integrity/evm/evm_crypto.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
There's no need to check for NULL before calling crypto_free_shash().
I find there is a crypto_shash_tfm() in the definition of
crypto_free_shash(). Will this lead to null pointer dereference
when we use it to free a NULL pointer?
No. It does &tfm->base, not tfm->base.
Thank you for your advice! I will resend a new patch soon.
Regards,
Dinghao