mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Jianglei Nie <niejianglei2021@163.com>,
	dmitry.kasatkin@gmail.com, jmorris@namei.org, serge@hallyn.com
Cc: linux-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ima/evm: Fix potential memory leak in ima_init_crypto()
Date: Wed, 06 Jul 2022 23:19:07 -0400	[thread overview]
Message-ID: <0196570e0deb244b5e846925098ddc5085dddaf9.camel@linux.ibm.com> (raw)
In-Reply-To: <20220704005932.2217025-1-niejianglei2021@163.com>

Hi Jianglei,

Thank you for the patch.

On Mon, 2022-07-04 at 08:59 +0800, Jianglei Nie wrote:
> ima_init_crypto() allocates a memory chunk for "ima_algo_array" with
> kcalloc(). When some errors occur, the function jumps to "out_array"
> and releases the "ima_algo_array[i].tfm". But "ima_algo_array" is
> not released, which will lead to a memory leak.

There's too much low level code details in the above paragraph.  The
patch description should be written from a higher level perspective. 
Refer to the original commit 6d94809af6b0 ("ima: Allocate and
initialize tfm for each PCR bank") for an example.
> 
> We can release the ima_algo_array with kfree() when some errors occur
> to fix the memory leak.

Please re-word the above sentence in the imperative mode.  Refer to
Documentation/process/submitting-patches.rst for an example.

thanks,

Mimi
> 
> Signed-off-by: Jianglei Nie <niejianglei2021@163.com>


  reply	other threads:[~2022-07-07  3:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-04  0:59 Jianglei Nie
2022-07-07  3:19 ` Mimi Zohar [this message]
2022-07-11  7:22 Jianglei Nie
2022-07-11 12:04 ` Mimi Zohar

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=0196570e0deb244b5e846925098ddc5085dddaf9.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=jmorris@namei.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 \
    /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

all inboxes | Powered by JetHome®