ACK: [PATCH 1/1] UBUNTU: SAUCE: Revert "mm/slub: fix a memory leak in sysfs_slab_add()"

Thadeu Lima de Souza Cascardo cascardo at canonical.com
Mon Sep 14 11:54:23 UTC 2020


On Thu, Sep 10, 2020 at 07:10:06AM -0300, Thadeu Lima de Souza Cascardo wrote:
> Yeah, the memory leak is certainly better than the bug, though I can't see how
> that commit would cause the bug in question.
> 
> Acked-by: Thadeu Lima de Souza Cascardo <cascardo at canonical.com>
> 
> -- 
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Okay, so I looked at the bug and it all makes sense now. I am glad we proceeded
with the revert:

So, kobject_put will call the ktype release, which is
mm/slub.c:kmem_cache_release, which calls
mm/slab_common.c:slab_kmem_cache_release, which calls
mm/slub.c:__kmem_cache_release.

After we sysfs_slab_add returns failure, we call __kmem_cache_release again,
which causes the double free.

So, there is still the case of properly fixing this memleak the reverted commit
claims to fix, and also avoiding creating the duplicate object.

Cascardo.



More information about the kernel-team mailing list