Skip to content

Commit fcf8891

Browse files
Qian Caitorvalds
Qian Cai
authored andcommitted
slab: fix a crash by reading /proc/slab_allocators
The commit 510ded3 ("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: 510ded3 ("slab: implement slab_root_caches list") Signed-off-by: Qian Cai <[email protected]> Reviewed-by: Tobin C. Harding <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 15ade5d commit fcf8891

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mm/slab.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -4308,7 +4308,8 @@ static void show_symbol(struct seq_file *m, unsigned long address)
43084308

43094309
static int leaks_show(struct seq_file *m, void *p)
43104310
{
4311-
struct kmem_cache *cachep = list_entry(p, struct kmem_cache, list);
4311+
struct kmem_cache *cachep = list_entry(p, struct kmem_cache,
4312+
root_caches_node);
43124313
struct page *page;
43134314
struct kmem_cache_node *n;
43144315
const char *name;

0 commit comments

Comments
 (0)