Re: [PATCH] fix memory leak in ramoops_init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 28, 2018 at 2:26 PM, Andrew Morton
<akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Mon, 17 Sep 2018 17:15:31 +0800 nixiaoming <nixiaoming@xxxxxxxxxx> 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@xxxxxxxxxxxx>
M:      Anton Vorontsov <anton@xxxxxxxxxx>
M:      Colin Cross <ccross@xxxxxxxxxxx>
M:      Tony Luck <tony.luck@xxxxxxxxx>
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



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux