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
| ||
|
Date: Thu, 13 Aug 2020 09:01:00 +0100 From: Lee Jones <lee.jones@...aro.org> To: Marek Szyprowski <m.szyprowski@...sung.com> Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org, Sylwester Nawrocki <s.nawrocki@...sung.com>, Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>, Krzysztof Kozlowski <krzk@...nel.org> Subject: Re: [PATCH 1/1] mfd: core: Fix memory leak of 'cell' On Thu, 13 Aug 2020, Marek Szyprowski wrote: > Hi All, > > On 05.08.2020 16:26, Marek Szyprowski wrote: > > On 16.07.2020 16:28, Lee Jones wrote: > >> When creating a platform device from an MFD cell description, we > >> allocate some memory and make a copy which is then stored inside the > >> platform_device's structure. However, care is not currently taken to > >> free the allocated memory when the platform device is torn down. > >> > >> This patch takes care of the leak. > >> > >> Signed-off-by: Lee Jones <lee.jones@...aro.org> > > > > This patch landed recently in linux-next as commit 126f33704d9d ("mfd: > > core: Fix memory leak of 'cell'"). Sadly it causes a regression on > > Samsung Exynos4412-based Trats2 board: > > ... > > Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b > > > > I suspect that this is somehow related to the deferred probe and/or > > devm_ helpers, but I didn't analyze it further yet. Reverting it on > > top of current linux-next (and resolving conflict) fixes the boot. > > Bisecting it was really hard because the issue is not fully > > reproducible, what suggests memory trashing. Various tests of > > linux-next with the reverted patch have shown at least that the issue > > is gone. > > > > I've compiled the kernel from exynos_defconfig, the dts used for the > > test is arch/arm/boot/dts/exynos4412-trats2.dts > > Finally I've found some time to analyze this issue. > > Indeed this patch is wrong it causes double free on the mfd_cell. > mfd_cell is already properly freed by the platform_device_release() > function when kref of the pdev goes down to zero: > https://elixir.bootlin.com/linux/latest/source/drivers/base/platform.c#L426 Thank you for the explanation. > I will send a revert with the explaination. No need. I remove it from my tree. Thanks. -- Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Powered by blists - more mailing lists