From: Kees Cook <keescook@chromium.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: nixiaoming <nixiaoming@huawei.com>, Jan Kara <jack@suse.cz>,
Amir Goldstein <amir73il@gmail.com>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Joel Fernandes <joelaf@google.com>,
Geliang Tang <geliangtang@gmail.com>
Subject: Re: [PATCH] fix memory leak in ramoops_init
Date: Fri, 28 Sep 2018 14:54:51 -0700 [thread overview]
Message-ID: <CAGXu5jLOv6X8-c1gpRLF6te5hzFD=-b8CSUpb_s+Xa0Pyd4fjA@mail.gmail.com> (raw)
In-Reply-To: <20180928142630.f4501105f413f2b5b4772a8b@linux-foundation.org>
On Fri, Sep 28, 2018 at 2:26 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Mon, 17 Sep 2018 17:15:31 +0800 nixiaoming <nixiaoming@huawei.com> wrote:
>
>> 1, memory leak in ramoops_register_dummy.
>> dummy_data = kzalloc(sizeof(*dummy_data), GFP_KERNEL);
>> but no free when platform_device_register_data return fail
>>
>> 2, if kzalloc(sizeof(*dummy_data), GFP_KERNEL) return NULL,
>> but platform_driver_register(&ramoops_driver) return 0
>> kfree(NULL) in ramoops_exit
>> so, add return val for ramoops_register_dummy, and check it in ramoops_init
>>
>> 3, memory leak in ramoops_init.
>> miss platform_device_unregister(dummy) and kfree(dummy_data)
>> when platform_driver_register(&ramoops_driver) return fail
>
> Looks right.
>
> It's unclear (to me) who maintains fs/pstore/ram.c. Let's add some
> Cc's and see if we can catch a reviewed-by.
It's me:
PSTORE FILESYSTEM
M: Kees Cook <keescook@chromium.org>
M: Anton Vorontsov <anton@enomsg.org>
M: Colin Cross <ccross@android.com>
M: Tony Luck <tony.luck@intel.com>
S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git
for-next/pstore
F: fs/pstore/
F: include/linux/pstore*
F: drivers/firmware/efi/efi-pstore.c
F: drivers/acpi/apei/erst.c
F: Documentation/admin-guide/ramoops.rst
F: Documentation/devicetree/bindings/reserved-memory/ramoops.txt
K: \b(pstore|ramoops)
I'll take review it and take it via the pstore tree. Thanks!
-Kees
--
Kees Cook
Pixel Security
next prev parent reply other threads:[~2018-09-28 21:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-17 9:15 [PATCH] fix memory leak in ramoops_init nixiaoming
2018-09-28 21:26 ` Andrew Morton
2018-09-28 21:54 ` Kees Cook [this message]
2018-09-28 22:18 ` Kees Cook
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='CAGXu5jLOv6X8-c1gpRLF6te5hzFD=-b8CSUpb_s+Xa0Pyd4fjA@mail.gmail.com' \
--to=keescook@chromium.org \
--cc=akpm@linux-foundation.org \
--cc=amir73il@gmail.com \
--cc=geliangtang@gmail.com \
--cc=jack@suse.cz \
--cc=joelaf@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nixiaoming@huawei.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).