From b4916cb17c261a6043bcb2a98d0d6512497a7cf8 Mon Sep 17 00:00:00 2001 From: Joonsoo Kim Date: Mon, 29 Oct 2012 22:59:58 +0900 Subject: percpu: make pcpu_free_chunk() use pcpu_mem_free() instead of kfree() commit 099a19d9('allow limited allocation before slab is online') made pcpu_alloc_chunk() use pcpu_mem_zalloc() but forgot to update pcpu_free_chunk() accordingly. This doesn't cause any immediate problema, but fix it for consistency. tj: commit message updated Signed-off-by: Joonsoo Kim Cc: Christoph Lameter Signed-off-by: Tejun Heo --- mm/percpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mm') diff --git a/mm/percpu.c b/mm/percpu.c index ddc5efb9c5bb..ec2589616e7d 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -631,7 +631,7 @@ static void pcpu_free_chunk(struct pcpu_chunk *chunk) if (!chunk) return; pcpu_mem_free(chunk->map, chunk->map_alloc * sizeof(chunk->map[0])); - kfree(chunk); + pcpu_mem_free(chunk, pcpu_chunk_struct_size); } /* -- cgit v1.2.3 From 5479c78ac6f688ea5ea8c49b44cf90ea87b63931 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Sun, 25 Nov 2012 01:17:13 +0400 Subject: mm, percpu: Make sure percpu_alloc early parameter has an argument Otherwise we are getting a nil dereference if percpu_alloc kernel boot argument is specified without value. | [ 0.000000] BUG: unable to handle kernel NULL pointer dereference at (null) | [ 0.000000] IP: [] strcmp+0x10/0x30 Signed-off-by: Cyrill Gorcunov Signed-off-by: Tejun Heo --- mm/percpu.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mm') diff --git a/mm/percpu.c b/mm/percpu.c index ec2589616e7d..8c8e08f3a692 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -1380,6 +1380,9 @@ enum pcpu_fc pcpu_chosen_fc __initdata = PCPU_FC_AUTO; static int __init percpu_alloc_setup(char *str) { + if (!str) + return -EINVAL; + if (0) /* nada */; #ifdef CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK -- cgit v1.2.3