From: Jarkko Sakkinen <jarkko@kernel.org>
To: Jianglei Nie <niejianglei2021@163.com>
Cc: jejb@linux.ibm.com, zohar@linux.ibm.com, dhowells@redhat.com,
jmorris@namei.org, serge@hallyn.com,
linux-integrity@vger.kernel.org, keyrings@vger.kernel.org,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] security:trusted_tpm2: Fix memory leak in tpm2_key_encode()
Date: Tue, 7 Jun 2022 13:09:56 +0300 [thread overview]
Message-ID: <Yp8j9FilcBMyeL2G@iki.fi> (raw)
In-Reply-To: <20220607074650.432834-1-niejianglei2021@163.com>
"KEYS: trusted: fix memory leak in tpm2_key_encode()"
On Tue, Jun 07, 2022 at 03:46:50PM +0800, Jianglei Nie wrote:
> The function allocates a memory chunk for scratch by kmalloc(), but
~~~ ~~
from with
There's more than one function in Linux - maybe you'd rather want
to write: "tpm2_key_encode() allocates ..."
> it is never freed through the function, which leads to a memory leak.
You can just write "it is never freed, which leads to a memory leak."
> Handle those cases with kfree().
"Free the memory chunk with kfree() in the return paths."
> Signed-off-by: Jianglei Nie <niejianglei2021@163.com>
Thank you finding this and providing a fix, it is highly appreciated.
Please don't take the nitpicking with the language personally. Just want
to have it documented in appropriate form.
BR, Jarkko
next prev parent reply other threads:[~2022-06-07 10:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-07 7:46 [PATCH] security:trusted_tpm2: Fix memory leak in tpm2_key_encode() Jianglei Nie
2022-06-07 8:34 ` Ahmad Fatoum
2022-06-07 10:09 ` Jarkko Sakkinen [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-06-08 2:59 Jianglei Nie
2022-06-08 8:00 ` Jarkko Sakkinen
2022-06-08 8:29 ` Ahmad Fatoum
2021-12-21 8:54 Jianglei Nie
2021-12-29 0:08 ` Jarkko Sakkinen
2021-12-12 13:54 Jianglei Nie
2021-12-12 21:21 ` Serge E. Hallyn
2021-12-21 8:33 ` Jarkko Sakkinen
2021-11-24 16:43 Jianglei Nie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yp8j9FilcBMyeL2G@iki.fi \
--to=jarkko@kernel.org \
--cc=dhowells@redhat.com \
--cc=jejb@linux.ibm.com \
--cc=jmorris@namei.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=niejianglei2021@163.com \
--cc=serge@hallyn.com \
--cc=zohar@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).