[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jLOv6X8-c1gpRLF6te5hzFD=-b8CSUpb_s+Xa0Pyd4fjA@mail.gmail.com>
Date: Fri, 28 Sep 2018 14:54:51 -0700
From: Kees Cook <keescook@...omium.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: nixiaoming <nixiaoming@...wei.com>, Jan Kara <jack@...e.cz>,
Amir Goldstein <amir73il@...il.com>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Joel Fernandes <joelaf@...gle.com>,
Geliang Tang <geliangtang@...il.com>
Subject: Re: [PATCH] fix memory leak in ramoops_init
On Fri, Sep 28, 2018 at 2:26 PM, Andrew Morton
<akpm@...ux-foundation.org> wrote:
> On Mon, 17 Sep 2018 17:15:31 +0800 nixiaoming <nixiaoming@...wei.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@...omium.org>
M: Anton Vorontsov <anton@...msg.org>
M: Colin Cross <ccross@...roid.com>
M: Tony Luck <tony.luck@...el.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
Powered by blists - more mailing lists