diff options
author | Qian Cai <cai@lca.pw> | 2019-04-06 18:59:01 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-10 17:53:11 +0200 |
commit | 3bb4e013a6c36cbeb0f9488d48e2f56dc9696a5c (patch) | |
tree | dc79164168dd29c39e312123ca867938268f1da1 /mm | |
parent | a8f82720673d41b85145f232c954fe3a365f72b5 (diff) | |
download | linux-stable-3bb4e013a6c36cbeb0f9488d48e2f56dc9696a5c.tar.gz linux-stable-3bb4e013a6c36cbeb0f9488d48e2f56dc9696a5c.tar.bz2 linux-stable-3bb4e013a6c36cbeb0f9488d48e2f56dc9696a5c.zip |
slab: fix a crash by reading /proc/slab_allocators
[ 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>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/slab.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/slab.c b/mm/slab.c index f4658468b23e..843ecea9e336 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -4299,7 +4299,8 @@ static void show_symbol(struct seq_file *m, unsigned long address) static int leaks_show(struct seq_file *m, void *p) { - struct kmem_cache *cachep = list_entry(p, struct kmem_cache, list); + struct kmem_cache *cachep = list_entry(p, struct kmem_cache, + root_caches_node); struct page *page; struct kmem_cache_node *n; const char *name; |