Re: [PATCH] drm/exynos: Fix memory leak and release IOMMU mapping structures

From: Lukasz Luba
Date: Mon Mar 09 2020 - 04:41:07 EST


Hi Inki,

On 3/9/20 12:45 AM, Inki Dae wrote:
Hi Lukasz,

20. 3. 5. ìì 7:00ì Lukasz Luba ì(ê) ì ê:
There is a memory leak which left some objects not freed. The reference
counter of mapping: 'mapping->kref' was 2 when calling
arm_iommu_detach_device(), so the release_iommu_mapping() won't be called.
Since the old mapping structure is not going to be used any more (because
it is detached and new one attached), call arm_iommu_release_mapping()
to trigger cleanup.

Found using kmemleak detector, the output:


[snip]


Signed-off-by: Lukasz Luba <lukasz.luba@xxxxxxx>
---

Hi all,

I have discovered this issue on OdroidXU4 while running some stress tests
for upcoming Energy Model. To reproduce it, kernel must be compiled with
DEBUG_KMEMLEAK. When the boot has finished, type:
# echo scan > /sys/kernel/debug/kmemleak
# cat /sys/kernel/debug/kmemleak
You should expect similar output to the one from the commit message.

I don't know if it should go via stable tree as well. I can resend with CC
stable, if there is a need.

Thanks for fixup. BTW, as you commented on Marek's patch thread, with Marek's patch the memory leak will be solved.
Do you want Marek to rework his patch on top of your patch or are you ok me to pick up only Marek's one?

Please drop this one and apply only Marek's patch, it fixes the issue.
I didn't know that he was working on similar stuff.


Marek's patch is conflicted with your one.

Thanks,
Inki Dae

Regards,
Lukasz