lkml.org 
[lkml]   [2018]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] fix memory leak in ramoops_init
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

\
 
 \ /
  Last update: 2018-09-28 23:55    [W:0.062 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site