]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
slab: fix a crash by reading /proc/slab_allocators
authorQian Cai <cai@lca.pw>
Sat, 6 Apr 2019 22:59:01 +0000 (18:59 -0400)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit8f9e811706adf9be1624a1742c5e153e990bd2df
tree4a4d06fd443f52d66693a09b7b2cf95d349b1f1b
parent7638d722b189ddc8d9341eb20146791aff342abe
slab: fix a crash by reading /proc/slab_allocators

BugLink: https://bugs.launchpad.net/bugs/1838459
[ Upstream commit fcf88917dd435c6a4cb2830cb086ee58605a1d85 ]

The commit 510ded33e075 ("slab: implement slab_root_caches list")
changes the name of the list node within "struct kmem_cache" from "list"
to "root_caches_node", but leaks_show() still use the "list" which
causes a crash when reading /proc/slab_allocators.

You need to have CONFIG_SLAB=y and CONFIG_MEMCG=y to see the problem,
because without MEMCG all slab caches are root caches, and the "list"
node happens to be the right one.

Fixes: 510ded33e075 ("slab: implement slab_root_caches list")
Signed-off-by: Qian Cai <cai@lca.pw>
Reviewed-by: Tobin C. Harding <tobin@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
mm/slab.c