]> git.baikalelectronics.ru Git - 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)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 8 Apr 2019 05:23:12 +0000 (19:23 -1000)
commit1bade64e4b1d4ecc599d847568b6cdf063faa1f9
treeec4e3e2411c268134933c6a0fc759f057d42161e
parent71ed5bcfd45ab35e5abdfc66d15f941b2df98047
slab: fix a crash by reading /proc/slab_allocators

The commit 107202cfb263 ("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: 107202cfb263 ("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>
mm/slab.c