lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALtPoQCskvbkEYE2m6Q=h_gPEV6+Abt+SJqLjVtAa+jReHGrzA@mail.gmail.com>
Date:   Thu, 2 Aug 2018 16:31:40 +0800
From:   Jheng-Jhong Wu <goodwater.wu@...il.com>
To:     gregkh@...uxfoundation.org
Cc:     devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] staging: mt29f_spinand: fix memory leak while
 programming pages

Dear greg k-h,

Before device is removed and freed memory automatically, programming
pages may run many many times.
Assume we erase and rewrite a large part of the flash, then
spinand_program_page() might exhaust memory if memory is not large
enough.
We may not remove and re-add the device between each programming page, right?
In fact, OOM indeed occurred when I tested programming multi-pages by
mtd_debug tool.
Erased first, then programmed pages.

Best Regards,
─────────────────────────
Jheng-Jhong Wu (Victor Wu)
E-mail: goodwater.wu@...il.com
─────────────────────────
Greg Kroah-Hartman <gregkh@...uxfoundation.org> 於 2018年8月2日 週四 下午4:03寫道:
>
> On Thu, Aug 02, 2018 at 03:51:30PM +0800, Jheng-Jhong Wu wrote:
> > In spinand_program_page(), it uses devm_kzalloc() to allocate memory to
> > wbuf dynamically if internal ECC is on, but it doesn't free memory
> > allocated to wbuf at the end of this function. Before the spinand device
> > is removed and frees memory automatically, programming pages may run many
> > times. This leads to a memory leak issue when internal ECC is on.
>
> How is this a memory leak?  The memory will be freed when the struct
> device is removed from the system.  How did you test that there was a
> leak?
>
> > Changelog:
> >
> > v2:
> > - use kzalloc()/kfree() to replace devm_kzalloc()/devm_kfree()
> > - add some descriptions to commit message
>
> this changelog goes below the --- line.
>
> thanks,
>
> greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ