From: Kees Cook <keescook@chromium.org>
To: qiwuchen55@gmail.com
Cc: anton@enomsg.org, ccross@android.com, tony.luck@intel.com,
linux-fsdevel@vger.kernel.org, chenqiwu <chenqiwu@xiaomi.com>
Subject: Re: [PATCH 1/2] pstore/platform: fix potential mem leak if pstore_init_fs failed
Date: Tue, 25 Feb 2020 11:13:53 -0800 [thread overview]
Message-ID: <202002251113.BF80CEAEB@keescook> (raw)
In-Reply-To: <1581068800-13817-1-git-send-email-qiwuchen55@gmail.com>
On Fri, Feb 07, 2020 at 05:46:39PM +0800, qiwuchen55@gmail.com wrote:
> From: chenqiwu <chenqiwu@xiaomi.com>
>
> There is a potential mem leak when pstore_init_fs failed,
> since the pstore compression maybe unlikey to initialized
> successfully. We must clean up the allocation once this
> unlikey issue happens.
>
> Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
Thanks! Applied to for-next/pstore.
-Kees
> ---
> fs/pstore/platform.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
> index d896457..114dbdf15 100644
> --- a/fs/pstore/platform.c
> +++ b/fs/pstore/platform.c
> @@ -822,10 +822,10 @@ static int __init pstore_init(void)
> allocate_buf_for_compression();
>
> ret = pstore_init_fs();
> - if (ret)
> - return ret;
> + if (ret < 0)
> + free_buf_for_compression();
>
> - return 0;
> + return ret;
> }
> late_initcall(pstore_init);
>
> --
> 1.9.1
>
--
Kees Cook
prev parent reply other threads:[~2020-02-25 19:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-07 9:46 [PATCH 1/2] pstore/platform: fix potential mem leak if pstore_init_fs failed qiwuchen55
2020-02-07 9:46 ` [PATCH 2/2] pstore/ram: remove unnecessary ramoops_unregister_dummy() qiwuchen55
2020-02-25 19:16 ` Kees Cook
2020-02-14 1:57 ` [PATCH 1/2] pstore/platform: fix potential mem leak if pstore_init_fs failed chenqiwu
2020-02-25 19:13 ` Kees Cook [this message]
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=202002251113.BF80CEAEB@keescook \
--to=keescook@chromium.org \
--cc=anton@enomsg.org \
--cc=ccross@android.com \
--cc=chenqiwu@xiaomi.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=qiwuchen55@gmail.com \
--cc=tony.luck@intel.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).